Validation rule during input

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
reiscons
User
Posts: 11

Validation rule during input

Post by reiscons »

Hi ,I have a form with two Quantities to be informed.
Qty1 and Qty2

I need to validate Qty2 not to be Greater than Qty1 ,

Any Idea to do this in PHP?

Roberto Reis


mobhar
User
Posts: 11767

Post by mobhar »

You may simply put your validation code in "Row_Inserting" (for Add page) and "Row_Updating" (for Edit page), for example:

if ($rsnew["Qty2"] > $rsnew["Qty1"]) {
$this->setFailureMessage("Qty2 cannot be greater than Qty1");
return FALSE;
}

Read also "Server Events and Client Scripts" topic from PHPMaker help file.


danielc
User
Posts: 1601

Post by danielc »

Also, you may use Form_CustomValidate for client script to validate your input. See Server event and Client script (Form_CustomValidate example in Client Scripts) in help file.

If you use PHP to validate, make sure you have enabled Server Side Validation, see PHP Settings in help file.


Post Reply