Form validation if required field not filled removes custom Javascript from loading

A form with custom Javascript that loads span elements works fine on page load. If the form is submitted but a required field is not filled out, thus throwing a “this field is required” error, the span elements loaded by Javascript disappears. I do not want that to happen.

Is there specific hook I need to reload the JS on?

You need to trigger your script on the gform/post_render event, so it will run when the form is initially rendered and when it is re-rendered following form page changes and validation errors:

Thanks Richard, that was exactly what I needed.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.