Forms - validation

Posted by Community Admin on 05-Aug-2018 02:56

Forms - validation

All Replies

Posted by Community Admin on 04-Apr-2011 00:00

It would be great in the forms module if there were a way to validate entry into some fields other than required or not.  Maybe I am missing something, but I would like the ability to have validation tests for SSN or phone number, etc.  I am assuming that I could create a custom field type, but a simple RegEx expression on a built-in text field would be better.

Posted by Community Admin on 05-Apr-2011 00:00

Hi Allen,

You can set forms validation from the UI by setting the ValidatorDefinition in the advanced settings of your text box. Please refer to this blog post for more information.

You can also use client side validation in the template of your designer or try validating the field you want inside your designer script. This thread form our forums explains in detail how you can achieve this.

I hope this information helps. Please contact me if you need further assistance with this issue.

Greetings,
Boyan Barnev
the Telerik team


Posted by Community Admin on 05-Apr-2011 00:00

I've seen these types of validation.  Is there a way to create your own?  Particularly, I would like validation for email address.  However, I would like other ones as well, phone number, SSN, etc.  I am reading your post on the JavaScript, but given all the special circumstance my user-base comes up with, I see nothing but edits - substantial edits. That is a little daunting.  It seems that a regular expressions validation would cover almost anything.  Anyway, thanks for the feedback.

Posted by Community Admin on 07-Apr-2011 00:00

Hello Allen,

Thank you for getting back to me. I have logged this functionality as a feature request in our system.To vote for it and follow its status you can visit this public URL. For now you can achieve this through code by setting this.Validator.RegularExpression to the desired regular expresion or if you have custom definition, you can read it from there. Another option, if you're using a custom designer for the field controls is to set this property from the designer.

All the best,
Boyan Barnev
the Telerik team


Posted by Community Admin on 11-Oct-2011 00:00

Dear Boyan

This is realy very common so please consider adding a regex for e-mail adresses.

Thanks

Posted by Community Admin on 20-Aug-2014 00:00
Posted by Community Admin on 03-Sep-2014 00:00

Dear Boyan

I started to make blog posts about stuff I came along in Sitefinity but probably am goint to forget again (old age). Sitefinity Hidden treasure

Forms are such a great feature but if I have to make mental notes that this is possible and how to do it - it will be absolutely impossible for my clients.

Could you consider a dropddown in the UI where the end user can set the type of validation?

Markus

Posted by Community Admin on 14-Sep-2014 00:00

I am trying to validate a number that cannot be more than 10 digits long. I've tried every combo of field types/limits/etc. and can't seem to get it to care how long the number is. Please see the attached doc for a summary of my current settings. Using these settings, I can succesfully submit numbers like:

123092847091823740129384701293847102938471029384710293847

What am I missing? What fields do I need to have set to require an entry to be numbers only, at least 9 numbers, but no more than 10.

 

Thanks!

Posted by Community Admin on 15-Sep-2014 00:00

Dear Beth

Can you try this as in the attached screenshot. Advanced options.

 Markus

Posted by Community Admin on 16-Sep-2014 00:00

Ah! So that's how to get regular expressions to work. Thank you!

Posted by Community Admin on 17-Sep-2014 00:00

Dear Beth

 No problem. Hope you got it working the way you want it.

Have a nice day

Markus

This thread is closed