Maintaining repeater conditionals with error messages

Hey! :slight_smile: I set up a repeater field on one of my forms, and I know that (technically) conditional logic isn’t supported in the php function side of things. I was able to accomplish the conditionals I needed using jQuery (specifically disabling and removing values from fields).

Some of the fields within the repeater are required, and if someone tries to submit the form without filling out one of the required fields, the validation errors pop up – which is fine, but here’s the problem I’m running into: when form reloads to show validation errors, it removes all of the jQuery that’s been applied to the fields… so if a field had a “disabled” attribute applied to it via jQuery, it now appears as enabled.

So I’m wondering, is there a way to maintain the jQuery applied to the fields if the form needs to reload because of validation errors?

Will the gform_post_render jQuery hook help you?

That could be used to apply your logic again after the page is rendered with a validation error.

I wasn’t aware of that hook, but it may be just what I’m looking for! I’ll explore it further and get back to you with an update. Thank you! :slight_smile:

Please let us know how far you get or if you get stuck. Thank you.