tyxla / Gravity-Forms-Multiple-Form-Instances

Allows multiple instances of the same form to be run on a single page when using AJAX.
GNU General Public License v2.0
38 stars 22 forks source link

Add a CSS class to each form #14

Closed tyxla closed 8 years ago

tyxla commented 8 years ago

Add a CSS class that contains the original ID of the form, allowing styling specific forms. For example such class can be gf-original-id-5.

tyxla commented 8 years ago

Done: https://github.com/tyxla/Gravity-Forms-Multiple-Form-Instances/compare/3f7fa1d02fe8c881636a54a8f05efcf3093fc706...47e52730d4794ab32bddf31f3f99bae9b6cdeaac

New class will be added to the .gform_wrapper div, and is called gform_wrapper_original_id_123, where 123 is the original form ID.

zackphilipps commented 7 years ago

@tyxla have you seen any issues where the class doesn't get added?

See https://www.braunability.com/wheelchair-accessible-pacifica/

If you scroll down to this section, and click on the "Contact a Dealer" and "Email Us" links, you'll see that "Contact" gets the original ID, while "Email" does not.

Any ideas as to why this would happen?

tyxla commented 7 years ago

Hi @zackphilipps, I can't say for sure without seeing the exact implementation, but the behavior inconsistency seems to me that it's an implementation issue, which is not related with the plugin. Perhaps your theme or any of your plugins is filtering the classes?

zackphilipps commented 7 years ago

@tyxla I did a project search for gform, disabled all the filters I could find, and still no luck. 🤷‍♂️

zackphilipps commented 7 years ago

@tyxla Looks like the issue occurs if the "CSS class" FORM setting is populated. It's also related to this forum post: https://wordpress.org/support/topic/issue-with-classes-with-original-form-id/

I'll submit a PR.

Edit: actually, my initial comment was wrong. There was no CSS class on the form. 🤷‍♂️

tyxla commented 7 years ago

I've just merged #26, will make sure to include it in the new version once it's released.

Thanks so much for your contribution, @zackphilipps!