Hi Liesbeth,
YOu can create more than one validation - but each one much have a different function name. customCheck1(), customCheck2() . . . or whatever names you choose as long as they are different from the existing validations.
You can apply any custom validation to more than one form element by adding the class as described in the FAQ.
You can put all of the custom validation code in the same Load JS action.
Bob
Thank you,
In one way or another I didn't put the regex in the right way and that did the trick๐ .
But now I have my own error message shown up as well as the regular validation text and it looks like this:
This field is required.
Please enter your name.
This field is required.
I just want my own text (Please enter your name.), like I added in the load js. Disabling jsvalidation in the form settings doesn't seem to matter.
Hi Liesbeth,
Do you still have the Required box checked on the element Validation tab?
Bob
Hi Bob,
Thank you; I unchecked the required box, but then it says:
This field is required.
Please enter your name.
Liesbeth
Hi Liesbeth,
Then there is probably still another validation on that form element. I can't tell where it is set though :-(
Bob
Hi Liebeth,
If I look at the Form HTML the Antal input has class="validate['required','%aantal'] validate['number']" with an error message for each of the validations which is correct.
The question is where are the two extra validations being set?
Bob
Hi Bob,
What do you mean with the "two extra validations"; I don't understand where you are referring to.
Does every has to have a validation?
Liesbeth
Hi Liesbeth,
You have three validations set: 'required', '%aantal' and 'number'. Each of these will add an error message if the validation fails.
Bob
Okay, thank you, I understand it.
But when I delete 'required' and 'number', the validation doesn't work at all.๐
Hi Liesbeth,
It looks as though you now have this working correctly?
Bob
Yes, I temporarely "solved" it by deleting the text "this field is required" from the language file.
Hi Liesbeth,
You still have a 'required' validation set on the inputs - that's why the 'required' error shows, or would show id you hadn't removed the message.
Bob
Hi Bob,
Yes, I know, but, as I said in an earlyer post: the validation does'nt work at all when I remove 'requiered' from the field class.
So this works: validate['required','%aantal']
And this doesn't work: validate['%aantal']
Hi Liesbeth,
It looks to me as though it works OK. It shows the error if there is an entry in the input that is not a number. It doesn't show an error if the input is empty because it it no longer required.
Bob