Web Form Repeats: Character Counts and Field Lengths

187
2
Jump to solution
03-26-2019 01:54 PM
Highlighted
Occasional Contributor II

I love that character counts automatically display in text fields now, but I noticed that in web forms, they only do so outside of a repeat. For web form text fields in a repeat, no character counts are displayed and--more importantly--field length isn't enforced. A user can enter in much more than the allowed length with no indication that it's incorrect. When submitting the form, a generic error appears stating "Failed to Submit: Operation rolled back. String or binary data would be truncated. The statement has been terminated" without indicating which question in particular caused the error.

While I found some discussion of the above error in different contexts, I couldn't find anything on this particular situation when I searched GeoNet, so I wanted to check if it's a known issue, and if it's being worked on at all. It looks like it works just fine in the field app, so that's good at least.

Fortunately, in the meantime for anyone else who might run into this, workarounds are simple enough using string-length():

For Display remaining character count: use concat(string-length(${example}), ' of 500') in the calculation of a note field.

For helping warn users who still managed to go over the limit, just use another note field with string-length(${example})>500 in the relevant column. This ought to give a user a heads up before they try submitting the survey.

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Esri Contributor

Hi Nick,

 

I can replicate this issue exactly as you described. I’ve logged an issue for this and added your post to the comments, but unfortunately can't give you a timeline for a fix.

Another suggested workaround to enforce a character limit and give a meaningful message when exceeded is to use a constraint and constraint message on your text question within the repeat. Here is an example of what that might look like in Connect and in the Web Form:

This will ensure the UI flags the question when the limit is exceeded (just as it does for text questions outside the repeat). You'll notice that the default message ("Please input (field_length) characters at most") is used outside of the repeat based on the actual field length alone. While my slightly different message ("Please enter ....") needs to be manually added to the constraint message field in Connect as shown above.

Hope this helps,

Brett

View solution in original post

2 Replies
Highlighted
Esri Contributor

Hi Nick,

 

I can replicate this issue exactly as you described. I’ve logged an issue for this and added your post to the comments, but unfortunately can't give you a timeline for a fix.

Another suggested workaround to enforce a character limit and give a meaningful message when exceeded is to use a constraint and constraint message on your text question within the repeat. Here is an example of what that might look like in Connect and in the Web Form:

This will ensure the UI flags the question when the limit is exceeded (just as it does for text questions outside the repeat). You'll notice that the default message ("Please input (field_length) characters at most") is used outside of the repeat based on the actual field length alone. While my slightly different message ("Please enter ....") needs to be manually added to the constraint message field in Connect as shown above.

Hope this helps,

Brett

View solution in original post

Highlighted
Occasional Contributor II

Thanks for the response--good to know it'll get looked into. And that's definitely a much simpler workaround than my note method--can't believe I spaced and forgot about using a constraint!

Reply
0 Kudos