This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
Extended validation in form
Started 15 years ago by PHPWimp | 2 posts |
-
Hi all,
I am looking to use MachForm for my field validation, but I also have additional application validation that needs to occur.
Here are 2 examples:
1) My user enters an email address. I will have MachForm check for duplicates, but I also need to be able to check the primary database to determine if the email address already exists. This would indicate that the user has already registered, so I need to throw an error. I would like that error to come up just as the errors do for field validation, but with a different message. So, the error would say 'That email address is already taken. Please enter a new email address.'.
2) My user enters a value they want to use for an application. I have Perl scripts that go and evaluate that code. It is easy enough to call Perl from PHP, but where do I insert it, and how do I get the result of that call to be used in the PHP scripts to flag an error.
In other words, they type in the word 'cat'. I check inventory, and we have no cats. So, I throw an error saying 'Parameter cat is unknown. Please re-enter.'
I have a ton of functionality in Perl that I would like to keep, and I want the user to stay on the same form until I have validated everything and written the data to my primary database for the application, which again is no problem through my Perl scripts. But, where do I put the call to the Perl scripts, and how can I add the error messages back to the JS error handling?
Thank all, I really appreciate the help.
Posted 15 years ago # -
I must say this one pretty hard to explain, since the backend processing is pretty complex.
Basically you'll need to modify one file "includes/post-functions.php" file.
Inside the file, there is the main form processing function "process_form()" which handle all form validations and submission.You'll need to dig into this function and play around to get clear understanding with the code.
Sorry if I can't be more helpful!
MachForm Founder
Posted 15 years ago #
Reply
You must log in to post.