AnsweredAssumed Answered

Sugar 7 - Form submitting before client-side validation

Question asked by Ramon Marcondes on Jun 22, 2016
Latest reply on Oct 18, 2016 by Ramon Marcondes

Hello.

I'm using SugarCRM Enterprise 7.5 for production system, and 7.7 for the test system.

I'm developing a package for form validation in the RevenueLineItems (it's called 'Receita' in brazilian portuguese) native module.

I followed exactly what this tutorial (link below) shows for validating form fields (to see the video, it needs a quick registration):

Registration

 

The difference is that in the tutorial, the form only submits after successful validation, but for me it is submitting even before the validation!

The manifest is set correctly, as the record.js file is called on the record EditView page.

 

I've uploaded a zip file (ReceitaCodeApi.zip) with all the used files if someone is interested on checking the code, especially the record.js, which does the validation.

 

Another thing, the custom error message is not working. I've done the same as this tutorial:

http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.6/UI_Model/Views/Examples/Adding_Field…

It's only showing the default error message.

 

What do I need to do to validate first, and save only if validation is correct?

I've already tried "return false" and "preventDefault", but they block the form from saving in the next try...

 

Any help would be appreciated.

Thanks.

Attachments

Outcomes