Reputation: 97
I am using the SugarCRM version 6.5.26 and I need to validate last_name so that it only accept alphabet Character in contact module. This need to be done on edit view. Currently it accept all type of value due to no validation on input.
Upvotes: 1
Views: 212
Reputation: 3293
Path: custom/modules/Contacts/metadata/editviewdefs.php
Code:
<?php
$viewdefs['Contact']['EditView']['templateMeta']['includes'] =
array (
array (
'file' => 'custom/modules/Contacts/js/editview.js',
),
);
?>
Add the javascript file you want to include into the location you referenced above(custom/modules/Contacts/js/editview.js). Check last_name field ID and use following code
$('input#last_name').bind('keyup blur',function(){ var node = $(this); node.val(node.val().replace(/[^a-z]/g,'') ); } );
Quick Repair, then browser hard refresh. All Done !
Upvotes: 1