• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Showing error on validation form

New Here ,
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

Views

320

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources
Documentation