Buy Now
Sign in

Required Field inside Repeater Area with Multiply - always fails validation

rikford , February 14 at 14:58
Answered
R
rikford
Hi,
I've just updated Chronoforms from v6.0.6 to 6.0.16, which has fixed problems with email formatting and the repeater area - good - but created a problem in that when a field in a Repeater Area is marked as Required, when submitting the form, the field fails validation whether it is empty or not. Similar fields outside the Repeater Area work fine.
I have added the {var:repeat_name.key} to the field name and id as previously mentioned in this forum. What am i missing? simple example of setup that fails validation whether First Name(s) is populated or not, is below. Validation tab just has Required selected.
Validation_fails.png
admin
Hi rikford,
Please test the form using the "Preview" button in the form edit page, does the form work as expected ?
I have just tested this with a single field form and it works fine.
Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
R
rikford
No, it doesn't - same issue
I've just done a test custom Javascript validation below, as mentioned elsewhere in the forum, and that does work. I guess I can tweak that to get the required result? But would be much easier if i can get it working without that. and I wouldn't get the red * for required field.
jQuery.fn.form.settings.rules.customfn = function(value, param) {​
​var x = 12;​
​if (Number(value) < Number(x)) {​
​return false;​
​}else{​
​return true;​
​}​
​};
admin
Can you post a link to the form here so I can check it ? you can have it inside a private box (the lock icon)
Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
R
rikford
Sadly, this is on a development site at the minute, not available from outside. I can set it up on another live site, I'll get back to you when I have...
Thanks
Rik.
R
rikford
Hi Max,
You can see the problem on this form:-
The content here is visible only for authorized users.
Thanks,

​Rik.
R
rikford
Hi Max, Any more thoughts?
admin
Hi rikford,
The validation works fine, before clicking "add" or after, all required fields are marked as required and the error is shown below, I tested this on Google Chrome browser, which browser do you use ?
Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
R
rikford
Hi Max,
I use Firefox primarily, also IE, Safari. Installed Chrome too, that also fails for me. from the Test form I indicated to you on Wednesday:-
Validation_fails_2.PNG
Attachments
Validation_fails_2.PNG
Validation_fails_2.PNG
(8.14 KiB)
128 Downloads/Views
admin
Hi rikford,
Ok, please press F12 on your keyboard to open the browser console, do you have any errors there ?
Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
R
rikford
Hi Max,
No error shown on F12.
Are you saying that when you access the test form site advised on Wednesday that, for you, validation works correctly? even though when i access the same form from four different browsers on three different devices, i still get the error?
Thanks,

​Rik.
J
Joao Serina
Hi Max,
I am having the same problem as rikford with my repeater areas. If the validation is turned on, the fields are filled properly and I submit the form I get the error saying the fields are empty.
I have tried loading the fields with validation turned off and then use the "multiply" button to turn it on (through the field events tab) but it does not work.
I also have no errors on the console.
(This happens both with Chrome and Firefox).
Thank you very much for your time.
Best regards,
Joao Serina
admin
Hi Joao,
You are speaking about the server validation which appears AFTER the form is sent, if this is correct then you are having the expected behavior, its not working with the repeater and you will need to configure the "Validate fields" action to skip the fields inside the repeater.
I will try to add this feature to a future update.
Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
J
Joao Serina
AH! I see. That's it So if I want server side validation I'll have to create my own custom PHP correct?
Thanks a lot!
[div]Best regards,
Joao Serina
[/div]
R
rikford
Hi Max,
Is that also the answer for my scenario? My incorrect validation errors only appear after pressing the Send button, when validation occurs prior to the email being sent.
Thanks,

​Rik.
J
Joao Serina
I just have one question, in the "Fields list" should I used the fields names, ids or classes?
The name of the one of my fields is "Sample-{var:area_repeater24.key}-Information[Identification]" but when I add it to the "Field list" I still get an error that the field is empty.
I have also tryed using "Sample-#area_repeater24.count-Information[Identification]" but it didn't work either.
I have looked in the manual but couldn't find the information.
[div][div]Best regards,
Joao Serina
[/div][/div]
R
rikford
Hi Max,
Your answer to Joao also fixed my problem.
In my example form, adding first_names{var:area_repeater3.key} as an exclusion to the Fields List of Validate Fields makes my form work as expected, no custom code required. Also had to set Fields list selection to All fields with validation rules but excluding those listed below.
Thanks.
Rik.
J
Joao Serina
Just figured it out! IF you want to store all the information from each repeated area into an array like I am doing, you will need to used the "validate data" Tool instead of "Validate fields".
When storing the info of repeated elements into a single array you name the fields as: Repeated_area_array[field_property] and for some reason, "Validate fields" doesn't work with that name structure.
All you need to do is to place the field name (ex: Repeated_area_array[field_property]) followed by the validation rules as shown in the manual page 15.
Example for a required field:
Repeated_area_array[field_property]/required:This field is required.
Thank you Max and rikford for your time!
Best regards,
Joao Serina
E
Elitakey
Hi to all, sorry for intrusion and perhaps too late, bet I had the same problem with Repeater field validation that resolved this way - instead of using built-in validation Toggle Required I put required:Required in the Validation rules field. At least this works for me.