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.

Clearing Default Field Values with jQuery when form is inside bootstrap modal

  1. handlebrand

    I have a framework that has bootstrap built into the theme. I built a modal that shows the form but am running into a few issues. When you load the form and click on the inputs the values clear and reappear. Once you submit the form, and it returns errors the script no longer clears the inputs. I have been researching this for quite a while and am running out of options. Does anyone have any idea how I can get this to work? I also have tried to attach styling to radio buttons, select boxes, and other elements using jQuery and run into the same issue when the form returns errors. Thank you in advance for any help I may get.

    Posted 9 years ago on Monday November 12, 2012 | Permalink
  2. Can you share the URL to the page where this form is embedded?

    In general though, you're scripts will not be available after a validation error. To ensure you're scripts are enqueued, even after a validation error, please see the gform_post_render hook:

    This jQuery hook is fired every time the form is rendered to allow custom jQuery to be executed. This includes initial form load, going to the next/previous page on multi-page forms, form rendered with validation errors, confirmation message displayed, etc.

    Posted 9 years ago on Tuesday November 13, 2012 | Permalink