Buy Now
Sign in

Validation rules

Arnold_S , February 20 2017
A
Arnold_S

Hi all,
I built a form inside CCv6. There are some advanced settings possibilities. e.g. validation rules, extra attributes, .... How can I use them for a e.g. required input ?
Thx

admin

Hi Arnold,

Here is an example of a validation rule:

				required:This field is required
				


The extra attributes are for the field, you may for example want to set a data attribute:
				
data-myattr:some data here
class:some field class


Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!

h
healyhatman

Hi Max - can you give more examples of validation rules? For example how I would construct a custom datamask and a custom prompt to go with it?

Or is there a list I can see showing the different validation rules you support? And the same for the extra attributes field (and the correct syntax?)

admin

Hi healyhatman,

The attributes can be anything, it will be added to the field tag, there are no specific "magical" attributes.

The validations rules are available in the "Text field" validation section already, the main function of the "Validations rules" box now is to use it for custom validations, an example on this can be found here:
https://www.chronoengine.com/faqs/74-chronoforms6/5293-validating-fields.html

Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!

h
healyhatman

I suppose it was more how they're constructed. For anyone else that wants to know:

Validation Rules
rule[specifics]:prompt
examples:
regExp[/[0-9]{4}/]:Must be 4 digits.
length[3]:Must be at least 3 characters

Attributes
attribute:value or group:attribute:value
examples:
height:100px
style:color:blue

(edit reason: didn't include the delimiters for the regex)

h
healyhatman

Hey Max how about the "Validate data" action in the Setup tab? Any instructions for how that works, and a list of the validation rules supported?

admin

Hi healyhatman,

The Validate Data has almost the same validation methods, this is the syntax:

				
field/required:this field is required
field/email:an email s required


Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!

h
healyhatman

"Almost" the same validation methods? Can you please list all the validation methods supported, so I don't have to guess anymore? :)

Z
Zyraj

Dude! what's with the useless answers! he might as well tell you to google it, goshhhh

Thanks healyhatman for doing the "support's" work! :)

GreyHead

Hi healyhatman,

Looking at the code - and I may not be looking in the right place - I can see these validations:

required
is_empty
no_spaces
match *
regex *
alpha *
alphanumeric *
digit *
nodigit *
number *
email
phone *
phone_inter *
url

Those with asterisks do not appear in the manual, but these do

is_integer
decimal

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

admin

Dude! what's with the useless answers! he might as well tell you to google it, goshhhh


Later the "Validate fields" action was introduced and that one automatically applies the rules you have configured in your fields! :)

Best regards

Max
If your main question got answered then please mark the answer using the button!