| Index
» Projekty
» phpMyEdit
» Fórum
» Input Validation |
 |
smokinpuppy
Založený: 26.03.2012
Príspevky: 14
Zaslal: 2012-06-19 22:41
Návrat hore
Odpovedať s citátom
|
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
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2012-06-20 14:18
Návrat hore
Odpovedať s citátom
|
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
Založený: 26.03.2012
Príspevky: 14
Zaslal: 2012-06-22 11:17
Návrat hore
Odpovedať s citátom
|
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
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2012-06-22 15:02
Návrat hore
Odpovedať s citátom
|
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
Založený: 07.12.2006
Príspevky: 33
Zaslal: 2012-09-22 20:28
Návrat hore
Odpovedať s citátom
|
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.
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|