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

Discussion

Discussion

Option to Disable Invalid Data Validation so that we can add values to checkboxes/radios?

posted on July 24, 2019

I would like to populate a checkbox with javascript, however when I do, I get the error on submission below. The variable does get set correctly so that we can use it in reporting and as metadata, but the error breaks the submission. Is it possible to disable this check so that we can dynamically set the values of a checkbox/radio?

Invalid form data was sent to the server. This can occur if the form is out of date. Please refresh this form and try again. [LFF2106-InvalidDataSent]

Here is the javascript that populates the options

     //For each value
  for(x=0;x<lookupTable.values.length;x++){ 
   
    //Create a choice container
    var choice = document.createElement('span');
    choice.classList.add('choice');
    document.getElementsByClassName('radio-checkbox-fieldset')[1].appendChild(choice);
    choice.classList.add('choice'+Num(x+1));
    
    let value = lookupTable.values[x];
    
  //Fill the container with an input and label
  $('.choice'+Num(x+1)).append('<input name="Field1" id="Field1-'+Num(x+1)+'" type="checkbox" value="'+value+'" vo="e" data-parsley-class-handler="#Field1" data-parsley-errors-container="#Field1" data-parsley-multiple="Field1">').append('<label class="form-option-label" for="Field1-'+Num(x+1)+'">'+value+'</label>');
    
  }

 

0 0
replied on July 24, 2019

In Angular (which is the framework that Forms is built on), the form will be defined on the server (which we don't have access to). So adding a form choice, then submitting that with the form when the server isn't expecting it, will return that the form data sent to it is invalid.

The better way of doing this would be to create all the radio buttons you need on the form designer, then use JS to target the radio button and set its value.

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

Sign in to reply to this post.