Web Form Repeats: Character Counts and Field Lengths

2150
9
Jump to solution
03-26-2019 01:54 PM
NickDierks1
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.

1 Solution

Accepted Solutions
BrettStokes
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

9 Replies
BrettStokes
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

NickDierks1
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!

0 Kudos
wayfaringrob
Frequent Contributor

Hey @BrettStokes  - this post is from over 3 years ago and I'm finding the same issue today. Could you direct me to the bug/idea posting or provide some details on what's going on? This seems like a basic functionality that I wasn't aware was missing until I had users emailing me wondering what was going on. Is there a simpler fix nowadays?

0 Kudos
wayfaringrob
Frequent Contributor

I have some users reporting that the warnings do appear when creating a new feature in the survey, but not when editing an existing one via a link (using the globalid URL parameter).

0 Kudos
wayfaringrob
Frequent Contributor

Sure enough, here is a field in a new survey entry:

rburkebsrc_0-1656360365961.png

And an edited entry:

rburkebsrc_1-1656360438621.png

The counter is missing from the latter.

SFM_TravisBott
Occasional Contributor III

Glad you've brought this to my attention, as I was hunting for ways to display character count. Turns out I am editing an existing feature class in my survey and that explains why it won't display. 

LiisiPark
New Contributor III

Is there any hope to fix this issu, to be able to present the remaining characters count also during the entry editing?

0 Kudos
wayfaringrob
Frequent Contributor

Would also appreciate an update @BrettStokes  or anyone from Esri.

0 Kudos
mwartman_grey
New Contributor III

I also have the issue of character counts not showing inside a repeat text question. The string_length constraint work-around is a good band-aid solution but would appreciate an update from ESRI about a permanent fix. 

0 Kudos