Hi everybody! I’m struggling with an issue regarding a validation form and showing an error. If the user wants to Add a New User, and if he clicks Submit button without entering a value(number) into the Age field, an error message must be shown. After I click the Submit button, an error from ColdFusion administrator appears…
While editing/adding the user information, the Age validation should be in place. If no value is provided, an error should occur. Empty value should not be allowed.
// Some validation form
public array function validateForm (
required string last_name,
required string first_name,
required numeric age
)
output="false"
hint="Some validation to from not empty"
{
var Error = arrayNew(1);
if(arguments.last_name EQ '')
{
arrayAppend(Error,'Please provide a valid Last name');
}
if(arguments.first_name EQ '')
{
arrayAppend(Error,'Please provide a valid first name');
}
if(arguments.age EQ '' OR NOT IsNumeric(arguments.age) )
{
arrayAppend(Error,'The age is empty or not number');
}
return Error;
}