AnsweredAssumed Answered

Web Form Repeats: Character Counts and Field Lengths

Question asked by NDierks@BoxElder on Mar 26, 2019
Latest reply on Mar 28, 2019 by NDierks@BoxElder

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 displaying the current 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.