Input length check

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

Input length check

Post by Newphpmkr »

How to check input length? Like 'A' field must be filled with 5 digits number . How to implement this?


sticcino
User
Posts: 1043

Post by sticcino »

based on which validation you selected -- client side or server side validation

override the Form_CustomValidate() and enter your validation code for the field.

Server Side:
function Form_CustomValidate(&$customError) {
$rs = $this->GetFieldValues("FormValue"); // Get the form values as array
if (intval($rs["Qty"]) % 10 != 0) {
// Return error message in $customError
$customError = "Order quantity must be multiples of 10.";
return FALSE;
}
return TRUE;
}

OR client side script (Client Scripts - Table Specific)

function(fobj) { // DO NOT CHANGE THIS LINE!

// Your custom validation code here, return false if invalid.
return true;

}

refer to the help file.


Post Reply