You are viewing limited content. For full access, please sign in.

Question

Question

LF Forms - Form data disappears upon submit if address control has invalid data.

asked on September 20, 2016

When I submit a Form that has any invalid data in the Address control, the form data disappears and I can't retrieve it.

0 0

Answers

APPROVED ANSWER
replied on September 21, 2016 Show version history

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!

1 0
SELECTED ANSWER
replied on September 21, 2016

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?

0 0

Replies

replied on September 20, 2016

What data you entered for Address field? And what version of Forms do you refer to?

0 0
replied on September 21, 2016

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.

0 0
APPROVED ANSWER
replied on September 21, 2016 Show version history

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!

1 0
replied on September 21, 2016

Wow...THANK YOU and more THANK YOU!

0 0
replied on September 21, 2016

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?

0 0
replied on September 21, 2016

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!

0 0
SELECTED ANSWER
replied on September 21, 2016

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?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.