0
Showing error on validation form
New Here
,
/t5/coldfusion-discussions/showing-error-on-validation-form/td-p/10930857
Feb 18, 2020
Feb 18, 2020
Copy link to clipboard
Copied
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;
}
TOPICS
Advanced techniques
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Have something to add?
Join the conversation

