0 => array (3. Create a javascript file file at custom/js/custom-validation.js and create function custom_check_form() to that file, for Example :
'customCode' => '<input type="submit" value="{$APP.LBL_SAVE_BUTTON_LABEL}" name="button" value="Save" id="SAVE_HEADER"
onclick="var _form = document.getElementById(\'EditView\'); _form.return_id.value=\'\'; _form.action.value=\'Save\'; if(custom_check_form(\'EditView\'))SUGAR.ajaxUI.submitForm(_form);return false;" class="button" accesskey="{$APP.LBL_SAVE_BUTTON_KEY}" title="{$APP.LBL_SAVE_BUTTON_TITLE}"/>',
),
function custom_check_form(view) {4 . Add this javascript file to the Editview using editviewdefs.php file. you may have to add below line to templateMeta of the editviewdefs.php file.
var validate = true;
if( <Your condition>) {
alert("Your massage");
validate = false;
}
if(validate && check_form(view)) {
return true;
}
else {
return false;
}
}
'includes' => array (
0 =>
array (
'file' => 'custom/js/custom-validation.js',
),
),
But it throws error of access when we create new record through sub panels (either quick create or full form)
Let say I have written above code on my Opportunity Save button. It working fine for Opportunity Module. But when I create new record in Opportunity from Account Subpanel, After saving record in Opportunity module. It throws error like this -
Error retrieving record. This record may be deleted or you may not be authorized to view it. |
Hi Aniruddh,
I have followed your code in SpiceCRM it worked able to validate fields. But in Opportunity module default Mandatory fields are not showing error message when click save it continue to submit form data can u please help me to solve this.
Hi Aniruddh,
I have followed your code in SpiceCRM it worked able to validate fields. But in Opportunity module default Mandatory fields are not showing error message when click save it continue to submit form data can u please help me to solve this.