Adding Validation Rules to "Label" Type Form Controls

Mike Bilz asked on July 29, 2020 22:37

Hello Kentico Community,

I have a form that pulls in data from query strings in the URL to fill certain fields. I am using "label" type form controls for these fields, with the content set by a macro in the default value. This all works great, and the form submits successfully when the query strings are filled.

However, I noticed that the validation check never triggers, even if the value of those fields is null. I have tried making the fields required, adding "minimum length" checks, and a few other obvious solutions, but none of them have worked.

Does the "Label" form control just override all validation checks? Is there a special way I need to write this to get the expected result? Do I need to include another field to check the content of the macros?

One of the query strings is used to populate the email address in the Email Notification, so even if there is a slim chance of this error occurring I would still like to prevent it and avoid the undeliverable emails.

Thanks in advance.

-mike

Recent Answers


Brenden Kehren answered on July 30, 2020 18:29

The "label" control has no validation. I'd suggest setting it to a textbox field and apply some css to the textbox to make it disabled or look like a label. This will allow for field validation to happen.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.