I have a custom module "incident" with a readonly field, when I save:
- the read only must receive a valor (like an auto increment)
- Do some queryes and validate result sets in order to determine if can or not insert in DB the new registry (in case of new incident)
- validate the default characteristics: required, etc (sugar normal things)
Obviously i need add some code over "save" button in editviewvardefs.php, I think is like:
IsNewIncident is my function.PHP Code:'form' => array('buttons'=>array(
array('customCode'=>'<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" '.
'accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="this.form.action.value=\'Save\';'.
'this.form.return_action.value=\'DetailView\'; '.
'return (IsNewIncident(---------------------) && check_form(\'EditView\'));" '.
'type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">'),
Im not sure the arguments, I can use a "form" arguent like document.editview, but so I need a javascript function. I won't to use javascript because I have MySQL functions and I understand javascript can't manage MySQL (java cans but not js) or I can pass only the 3 arguments I really need, like "fields.name.value"
I want to use a php function. I have one now and I've tested it separately and works correctly. But now the problem is how can I link it whit sugar?
Since the function determines the value for the redonly field, I need to return it to the "main" code in order to sugar save it with the other fields.
so: How can I call a php function pushing Save button in Editviewdefs.php?
thanks very much.
Windows Server 2003
Sugar 5.0a
PHP 5.2.5
MySQL 5.0
Apache 2.2.4


LinkBack URL
About LinkBacks



Reply With Quote
I've checked some tutorials about ajax and I understand this:
but I continue thinking is easier with pure php
It has an include for file.js but im not sure where is calling it and i don't found the tpl
Bookmarks