Custom validator of HTML form parameter

By using custom validator, you can use validator with custom logic.

For example, you are going to write registration form of login user, you have to check the id is already exists or not.

HTML

 In order to use custom validator, write "custom" at the attribute value of "alns:validate".

Write validation logic int the script

 Write logic to validate in the script where form post or send get method of http. Next code is the sample.

If the parameter value is normal, write function named "validate" with parameters like the code.

If the value is array, function named "validateArray". In Alinous-Core, parameter's name is ends with "[]", the parameter is recognized as array.

When validation failed, return error code as string. If avalidation passed, return 0.

Show wrror message

 Write the error code in "alns:validate" attribute. Other stuff is same with standard validator.


Go to Top