When I submit a Form that has any invalid data in the Address control, the form data disappears and I can't retrieve it.
Question
Question
LF Forms - Form data disappears upon submit if address control has invalid data.
Answers
Hi Kellie,
So the issue is that the form will not store to the repository if the value of the Address is a longer string than allowable by the max length set in the repository? If so, this isn't unexpected. In the Event Log you should see messages along the lines of "Bad field value ('Address'): The parameter is out of range or too long. [9020]". The submission data should still be available; if you go to the Instances dashboard, you should be able to see that the task is suspended and view the data from the submission. See this video for an example.
To add a form of validation to truncate the value of this field to the first 20 characters, you can include this simple custom JavaScript:
$(document).ready(function () { $('.address-area .Address1').on('change',function() { if ($(this).val().length > 20) $(this).val($(this).val().substring(0,20)); }); });
Here "address-area" is a class to assign to the Address variable block in the form editor, and "Address1" is a class of the input element corresponding to the first line of the address; to find the appropriate class for other elements, you can use the DOM Explorer in the Developer Tools pane (F12).
Some slightly longer JavaScript to apply some obvious error formatting to the field, and to disable the Submit button, when the length is greater than twenty.
$(document).ready(function () { $('.address-area .Address1').on('change',function() { if ($(this).val().length > 20) { $(this).css({borderColor:'red',backgroundColor:'#ffcccc'}); $('.Submit').attr('disabled','disabled'); } else { $(this).css({borderColor:'initial',backgroundColor:'inherit'}); $('.Submit').removeAttr('disabled'); } }); });
If the issue is that the submission does not even appear in the list of Instances and therefore the variables are not present, please open a case with Support. Include the Forms process exported as an XML file, along with a briefcase export of an entry which has the example Address field assigned to it as metadata.
Hope this helps!
Sounds good. If the submission itself (as opposed to the STR task) actually failed because of that error, it would be a much more serious issue.
If you don't mind, would you mark that as an answer to keep it from being lost in the collapsed replies in the thread for others who might run into this?
Replies
What data you entered for Address field? And what version of Forms do you refer to?
Using Forms 10.1. If a user wanted to break my form, he could enter 30 characters in the Address Control State field and the form just disappears upon submit. All my other fields I have character limits on how much data can be entered. But in Forms 10.1 the Address Control does not limit the character input. A user could put 1000 character state in and that will fail, saving to the repository if my template field only allows a 20 character state.
Hi Kellie,
So the issue is that the form will not store to the repository if the value of the Address is a longer string than allowable by the max length set in the repository? If so, this isn't unexpected. In the Event Log you should see messages along the lines of "Bad field value ('Address'): The parameter is out of range or too long. [9020]". The submission data should still be available; if you go to the Instances dashboard, you should be able to see that the task is suspended and view the data from the submission. See this video for an example.
To add a form of validation to truncate the value of this field to the first 20 characters, you can include this simple custom JavaScript:
$(document).ready(function () { $('.address-area .Address1').on('change',function() { if ($(this).val().length > 20) $(this).val($(this).val().substring(0,20)); }); });
Here "address-area" is a class to assign to the Address variable block in the form editor, and "Address1" is a class of the input element corresponding to the first line of the address; to find the appropriate class for other elements, you can use the DOM Explorer in the Developer Tools pane (F12).
Some slightly longer JavaScript to apply some obvious error formatting to the field, and to disable the Submit button, when the length is greater than twenty.
$(document).ready(function () { $('.address-area .Address1').on('change',function() { if ($(this).val().length > 20) { $(this).css({borderColor:'red',backgroundColor:'#ffcccc'}); $('.Submit').attr('disabled','disabled'); } else { $(this).css({borderColor:'initial',backgroundColor:'inherit'}); $('.Submit').removeAttr('disabled'); } }); });
If the issue is that the submission does not even appear in the list of Instances and therefore the variables are not present, please open a case with Support. Include the Forms process exported as an XML file, along with a briefcase export of an entry which has the example Address field assigned to it as metadata.
Hope this helps!
Wow...THANK YOU and more THANK YOU!
So to confirm, the issue was that the pages of the form would not store to the repository, not that the entire instance seemed to be lost?
Correct. I didn't realize I could get to the instance. Your post was most helpful. And the other issue was that I could not limit the data entry on the Address Control fields. I see that I can put Javascript around that. Thank you!
Sounds good. If the submission itself (as opposed to the STR task) actually failed because of that error, it would be a much more serious issue.
If you don't mind, would you mark that as an answer to keep it from being lost in the collapsed replies in the thread for others who might run into this?