skip to Main Content

For context:

Form created in FormAssembly. Form has been built and extensive connectors & logic structured around this checkbox value, as well as conditionally displayed sections/fields.

Client has now stated that a value in a multicheckbox field (tfa_11) should always be true and should not be able to be changed.

Is there any way to achieve the desired performance using only the existing field?

Only code currently for form itself is the attempt to disable:

document.addEventListener(“DOMContentLoaded”, function(event) {
document.getElementById(“tfa_11”).disabled = true;
});

I know I can disable checkbox but this doesn’t post data. I know that I can also have a dummy display and then process the value with the hidden field, but if I do that, all dependent conditional sections/formulas/post-processing connectors need to be remapped to account for the hidden field value.

2

Answers


  1. You can give it an event listener that calls event.preventDefault() so the click has no effect.

    document.addEventListener('DOMContentLoaded', function(event) {
      document.getElementById('tfa_11').addEventListener("click", e => e.preventDefault());
    });
    <input type="checkbox" id="tfa_11" checked>
    Login or Signup to reply.
  2. What I understand is that you are trying to disable the field and always send a true value in the form.

    If so, then disabled will not work for you.

    What I always apply is to place it checked by default and remove the function of changing the value with the click.

    This is an example of how I normally work in an ERP. You can guide yourself:

    <input onclick="return false;" checked="true" type="checkbox" name="tfa_11" value="1" id="tfa_11"/>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search