Data input validation?

Hi,

I’ve created a form that links text and radio filters to an input data cube.

Currently a user can submit the entry without completing all the fields.

In the case where a user hasn’t completed a field or not correctly e.g. too many characters I would like to throw and error before the user can submit the data (send data action).

Are there any examples of this? I suppose I’m looking for a script that would show a layer stating that field X needs to be completed because it contains value Y on a click of the submission button?

Kind regards,
Shane

1 Like

Hey Shane, you will need to check individual elements in the form as each one of them will have different set of rules. Use can build Javascript to handle form validation in this case.

For example: I created a simple script that checks if the textbox is empty. If yes, it shows an alert. I added this script in the “on click “ event of the submit button but you may use something similar in the on click event of the confirmation popup and redirect the client to a new alert box for incomplete data.

if(label1.labelText==’’)

{

alert(“Please complete the form”);

}

else alert(“Thanks for entering”);

You can refer to this link where you can search about the properties of individual form components and use them to set validation rules.

1 Like