In a Logic Hook I want to check compare a value to another value and it this value already exists I want to cancel the save.
Or would it be better to do this in the Edit View?
Rgds
Chris
In a Logic Hook I want to check compare a value to another value and it this value already exists I want to cancel the save.
Or would it be better to do this in the Edit View?
Rgds
Chris
I think is better build this validation code before the form submit.
When I have to make more complex validations as your case, I usually overwrite the function called on onclick event of save buttons, to first call my custom validation and then if success validated call the normal code.
Rafael Queiroz Gonçalves
Advanced OMG UML Certified Professional
Sun Certified Enterprise Architect for the Java Platform
Sun Certified Programmer for the Java 2 Platform
IBM Certified Advanced Application Developer - Lotus Notes and Domino
IBM Certified Application Developer - IBM WebSphere Portlet Factory
Computer Science Mastering / UFSC - PPGCC
Hi,
You wouldn't an example of this. I've tried to include javascript in the EditView that will trigger when the date field is changed. But with that when I press the button to select a date it stays at this stage and will not go any further.
I have to select the date and press the X but this doesn;t trigger a simple alert I have.
Rgds
Chris
If you need to compare a form field against database fields so DevToolKit fits your needs.
If you need to copare a form field against some other form field so addToValidateComparison fits your needs.
Cheers
André Lopes
DevToolKit / Project of the Month - June 2009
Lampada Global Services- Open Source Solutions
Avenida Ipiranga, 318
Bloco B - CJ 1602
São Paulo, SP 01046-010
Brazil
Office: +55 11 3237-3110
Mobile: +55 11 7636-5859
e-mail: andre@lampadaglobal.com
Lampada Global delivers offshore software development and support services to customers around the world.
Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.
I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.
Hi,
What I have done is in the view.edit.php I am using Javascript to compare the entered value to that of values that already exist.
Rgds
Chris
Also there is this solution: http://www.sugarcrm.com/forums/f6/ca...216/#post76452
It says to do "an exit" instead of return null on logic_hook method.
Rafael Queiroz Gonçalves
Advanced OMG UML Certified Professional
Sun Certified Enterprise Architect for the Java Platform
Sun Certified Programmer for the Java 2 Platform
IBM Certified Advanced Application Developer - Lotus Notes and Domino
IBM Certified Application Developer - IBM WebSphere Portlet Factory
Computer Science Mastering / UFSC - PPGCC
After try that, I found the way it really works.
Add this code on before_save logic_hook
PHP Code:if (<condition>) {
header("Location: index.php.....");
exit;
}
Rafael Queiroz Gonçalves
Advanced OMG UML Certified Professional
Sun Certified Enterprise Architect for the Java Platform
Sun Certified Programmer for the Java 2 Platform
IBM Certified Advanced Application Developer - Lotus Notes and Domino
IBM Certified Application Developer - IBM WebSphere Portlet Factory
Computer Science Mastering / UFSC - PPGCC
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks