Index
» Projects
» phpMyEdit
» Forum
» Input Validation |
|
smokinpuppy
Joined: 26 Mar 2012
Posts: 14
Posted: 2012-06-19 22:41
Back to top
Reply with quote
|
Hi,
I have a table that has an email field which is a unique key. Is there a way to validate the form before it tries to do the insert and give a warning that there is a duplicate email address so the user can try a different address?
Thank you in advance,
Robert
|
doug
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2012-06-20 14:18
Back to top
Reply with quote
|
You would need to create a trigger to handle this.
http://opensource.platon.sk/projects/doc.php/phpMyEdit/html/configuration.triggers.html
Presumably in your trigger you would query the database prior to Add or Update calls, and conditionally exit gracefully (kill the phpMyEdit process).
Use the forum's Search feature to look for examples which would likely contain these words: trigger newvals
|
smokinpuppy
Joined: 26 Mar 2012
Posts: 14
Posted: 2012-06-22 11:17
Back to top
Reply with quote
|
Thank you very much doug, I got it to work, but how can I make the application stay on the add/edit page if there was an error with the same input still there?
Thank you,
Robert
|
doug
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2012-06-22 15:02
Back to top
Reply with quote
|
If validation fails, you have to terminate the process and instruct the user to Go Back. I've never found a method to re-display the form along with a validation error message, though there might be some way to do this.
|
JammerPro
Joined: 07 Dec 2006
Posts: 33
Posted: 2012-09-22 20:28
Back to top
Reply with quote
|
Can someone direct me to where the code for the javascript is located in the class file (i.e. like when you use it to validate a phone number, or email address... I may be able to program something that bypasses the triggers with AJAX and keep the info on the page.
|
Post new topic
Reply to topic
|
|
|
|