PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Field with disabled options

  1. I have a form( link )with a multiple choice field, and one of the options need to be disabled but visible. This works fine with a simple jQuery statement

    $("#choice_23_0").attr('disabled', true);

    in footer.php, however, if the user submits the form and some fields are not validated, the previously disabled fields become enabled again. How can i prevent this from happening?

    Posted 8 years ago on Friday September 9, 2011 | Permalink
  2. I'm assuming you're using Ajax to submit your form here. I'm sure your script is loaded when the document itself loads and that's when it gets applied to your form markup. When you submit the form via Ajax, the parent page/document itself does NOT get reloaded, so the script doesn't get re-applied.

    You can drop the Ajax submission method and it should work for you then. If you're married to that, I'm not sure if we have a filter that will enable you to re-fire a script on a validation error or not. I do know that we have one to do just that for each page of a multi-page form but not sure about this scenario.

    I've asked one of our programmers to follow up on this to be sure and post back here with his thoughts later.

    Posted 8 years ago on Friday September 9, 2011 | Permalink
  3. I was discussing this with the team and it came up that you could actually make use of the "gform_pre_render" filter and include your jQuery script there. That filter fires when the form is submitted so it wouldn't be dependent on the parent document to load to apply the script.

    http://www.gravityhelp.com/documentation/page/Gform_pre_render

    Posted 8 years ago on Friday September 9, 2011 | Permalink
  4. Ok, i'll give that a try.

    Removing ajax did the trick, but it would be great if I didn't have to remove it.

    Thanks.

    Posted 8 years ago on Tuesday September 13, 2011 | Permalink