Issue with Required Fields Inside a Repeater

3010
21
09-19-2016 05:27 PM
JakeMatthys
Occasional Contributor II

I have a survey which has some required fields, the survey also has a number of repeaters and these repeaters also have required fields.  The form has a multi select and each repeating option is relevant to the multi select.  So if the user selects 3 items, lets say pipes, valves and hydrants, the user will get 3 repeating sections to populate.  We are experiencing an issue where the required fields are enforced in the first repeater, but is not enforced in subsequent repeaters.  In the first repeater, if all required fields are populated, the form can be submitted, if not, the form identifies the required field that needs populated.  This holds true for all repeat occurrences within that first repeater.  In the subsequent repeaters the required fields are not validated by the UI.  What we are finding is that as long as the user has populated all the required fields in the main form and in the first repeating section, required fields that have not been populated in subsequent repeater sections are submitted by the form.  I would expect the form to not submit and to warn the user that required fields have not been populated.  

Has anyone else experienced this issue?  I have uploaded the excel form document if anyone would like to take a look.

Thanks,

 - Jake

Tags (2)
21 Replies
JakeMatthys
Occasional Contributor II

Thanks Ismael Chivite.  We will begin testing this new release for our customers during our next sprint cycle which will begin after the new year.

 - Jake

0 Kudos
Nicole_Ueberschär
Esri Regular Contributor

I just downloaded the new versions from the 1.10 release and tested again my form with required fields within repeats. Unfortunately I still get the (almost) same results: If I don't "touch" the second repeat, the fields are not considered as required and I can submit the form without filling the data for the required second repeat. Only when I switch to the second repeat and try to submit or try to go back to the first I have to fill the required fields. So I would say we are a step further but not at the level I need it to be. 

(Tested on Windows Desktop, iOS 10.2 on iPhone 6s and Android 4.4.2 on Samsung Tablet)

0 Kudos
JakeMatthys
Occasional Contributor II

Hi nicueber‌, I tried to test the scenario that I think you are describing but in my test, the required fields behaved.  In my scenario, I filled out a repeater, added a 2nd page to my repeater, and did not "touch"/add any data to the 2nd repeater and tried to submit my form.  The form would not submit and I was prompted to populate the first required field in the 2nd repeater.  My test was on Survey123 IOS version 1.10.23 on an iPad tablet.

Let me know if I did not replicate your scenario.

 - Jake

0 Kudos
Nicole_Ueberschär
Esri Regular Contributor

Thank you Jake for testing. I create a number of repeats depending on the answer of question 3.1 in the attached file (you have to chose Agriculture as landuse in 2.1). And as long I don't open the second repeat I can submit my form without filling it. I would be happy if you could have a look at my form. 

0 Kudos
JakeMatthys
Occasional Contributor II

Hi nicueber,

I took a look at your form and confirm that required fields did not behave in repeaters that were not yet exposed.  Your form is different than my example, your form sets the number of repeaters based on a previous question.  As a user, if I just satisfied the 1st page of the repeater, even though the repeater had more pages, the form was able to submit.  Looks to me like you should continue to forward your issue to the ESRI Survey123 team so that they can investigate.  Good Luck...

- Jake

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Nicole,

Thanks for sharing this survey.  The key point appears to be that when you set the number of repeats using repeat_count, the expectation is that *exact* number of repeats must be submitted.  

0 Kudos
RebeccaLehman
Esri Contributor

Hey James, We are having the same issue in the solution product Homeless Point- in-Time Count with repeats in a form. We identify how many repeats to create based on the response to a previous question. In a mobile app form of the survey, if the user does not click over to the repeats, they are able to submit the form without filling them out. I have attached the survey schema here. 

Thank you!

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Rebecca,

I can see the behavior you are describing.  One technique to work around might be to use a question with a count() function and compare to the repeat_count calculation; if not equal, have a constraint alert the user.

0 Kudos
Nicole_Ueberschär
Esri Regular Contributor

Thanks, I think this is a work around that could work.

(I just remembered my question about calculations among repeats from some time ago and found that it was implemented! Very nice! Thanks a lot.)

Now, if I would use the count() function within the repeat, how would I get the result of the last repeat to compare it with my desired repeat_count? Is there a way to pick the answer from a certain (in this case the last) repeat? 

EDIT: I figured it out. (I thought I would need a counter within the repeat but count(answer) does the job.) An open question would still be if there is a way to get the answer of a certain repeat, e.g. if I want the sequence of used means of transport and the last repeat must always be "by foot". Something like ${means_of_transport}[count(${means_of_transport}-1]?

0 Kudos
RebeccaLehman
Esri Contributor

Hey James and Nicole, 

Thanks for your response, here is what I tried. 

New hidden field with calculation count(${survey_date_repeat}) = ${total_household} and a constraint of 0 (I also tried TRUE) and constraint message “You must enter information for additional household members”.

 

If I keep this field visible, I can see it turn from false to true when I go to the second repeat section, but I am still able to submit the form. I also tried to split this up into two separate survey question. In all the iterations I have tried, I can either get the constraint message to always show up or never show up. 

Let me know if you have any ideas!

0 Kudos