inboundnow / retired-cta

Create Calls to Action for your WordPress site. Monitor and improve conversion rates, run A/B split tests, customize your own CTA templates and more
http://www.inboundnow.com/cta/
1 stars 3 forks source link

Inbound forms: css IDs not unique #134

Closed daprela closed 9 years ago

daprela commented 9 years ago

I don't know if this is the most appropriate place to post issues about forms, please let me know if I have to post them somewhere else.

The system gives an ID to each field in a form. However, there's a problem. In CSS, IDs are supposed to be unique. If I give the same name to two fields, they will end up having the same ID because the ID is named after the field name. I suppose I'd have the same problem if I'd post the same form twice in a page (like, in the footer and in a sidebar), or two different forms but with a few fields having the same name

atwellpub commented 9 years ago

So the issue is if two forms have the same field name they will have the same class name and id name and that means they are unabled to be styled via external styling rules separately?

daprela commented 9 years ago

Actually, other forms plugins like contact form 7 don't use IDs at all. If you cannot guarantee that every ID is unique across all of your forms (and in my opinion it's hard to do it), it's better to avoid adding IDs at all, and work only with classes, just to avoid any confusion to the advanced user that wants to add his own styling.

DavidWells commented 9 years ago

IDs were added for faster lookup with jQuery/js ( they are faster than searching the dom for classes )

I don't think we can remove this without breaking alot of stuff ( custom CSS rules, custom JS actions, etc used by folks)

DavidWells commented 9 years ago

We can have the custom post type ID print out in classes field but we can't remove the non unique ID because of backwards compatibility.

The only fix to remove it is introducing a new form tool (which I'd like to do in the future)