last day (22 days later) » 

10:22 AM
0
A: How to display error message for field validation in SugarCRM?

StarThis is something related to javsacrip/jquery error handling and you can find many logics on google as well. Try following code: $('input#last_name').on('change', function () { var node = $(this); current_val = node.val(); trimmed_val = node.val().replace(/[^a-z]/g, ''); ...

 
hi star is working but there some issue when i am click save button then record have been created. i want to not create have record
 
so simple, see updated answer.
 
hey star not worked ur answer. record should not be saved
 
last name is required field?
 
yes last name is required
 
10:22 AM
you can see that i am setting save button as disabled, i.e. $("#SAVE").attr("disabled","disabled"); . See if your save button ID is different then replace it accordingly.
there?
 
but this is not proper save to validation see when opportunity created time when u fill Opportunity Amount: test then error message through Invalid Value: Opportunity Amount
 
that is something else
 
i want to this type error display in last name field
 
that is complete field type
i have provided sample js code which display error message using custom html
now you can style it
i think you know js, html and css
so all are upto you know
 
yes very well but i am new in sugar crm so
why we r not use this type of error validation
??
 
10:30 AM
if you inspect it
then you will see that for error message it use is something like this
<div class="required validation-message">Invalid Value: Opportunity Amount</div>
so you can change error html accordingly
 
u r right but my issue when i click save button then can't create save record nd highlight error message and when ever this message am not write proper that time can't save record
like Opportunity Amount: field
 
10:45 AM
for that you will need to create custom field type
then add your validation message in non-upgrade safe manner
therefore better to do some custom JS, CSS and HTML work to achieve your requirements because SuiteCRM is afterall web app and you can write any good code in supported languages i.e. PHP, Javascript , Jquery and CSS etc
and you not even vote up my answer after getting so much my time
 
11:00 AM
check updated answer
if you want to get help then you have to be good and supportive
actually this function
add_error_style('EditView', 'last_name', 'Please enter correct value for last name',true);
do a trick
this is used by SuiteCRM core files so read their code and understand that this custom way can give what you looking for
there ?
 
ok
but still save record
 
11:29 AM
inspect element and share your save button html
 
11:55 AM
<input type="submit" id="SAVE_HEADER" value="Save" name="button" onclick="var _form = document.getElementById('EditView'); _form.action.value='Save'; if(check_form('EditView'))SUGAR.ajaxUI.submitForm(_form);return false;" class="button primary" accesskey="a" title="Save">
 
updating my answer
check updated answer
hopefully now it will work for you
 
your crm have dev instance?
can you provide me temp login cred(if you face any further issue then )
 
done it working fine
thanks star
for help me
 
12:13 PM
you are welcome
sometime you irritate me but then i think that i also faced similar kind of issues while starting working on Sugar/Suite
your fb profile link ?
?
 

  last day (22 days later) »