[Resolved] "For" in label for radio button does not take correct value
This support ticket is created 6 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I'm styling radio buttons in a way that the input itself is hidden and I need the label to be responsive to clicks. Without correct "for" attribute it's imposible to achieve.
Please fix that asap.
FYI: Some of the forms on the site are build in an "old" way and they work correctly.
This gave me a look as I attached in the screenshot.
This was possible due to 1. the layout where the label goes after the input, and 2. the "for" attribute for the label was equal to input id, so clicking on the label made the radio button selected.
In the new layout the "for" attribute has a different value than the input id, so clicking it does nothing and I can not hide the input. This breaks completely the design that was already built on the site.
Can't you just make "for" take the same value? That would solve the problem quickly.
This is how it should work anyway, isn't it?
If I was to suggest the "for" to be added as an attribute it would not be implemented anytime soon and the normal process of requests would apply an would take some time.
You could attribute using Javascript on the frontend or you could try adding a class to the label that will give it the same class the generated input tag if i''m following correctly.
You need to have the Label and input tag having some common class or name correct?
Well, what I need ideally is that the new forms I add to the site work the same way as the old ones without javascipt tricks.
The old forms have the same "for" and "id" in radio buttons. By what logic did you change it? You competely sabotaged my work. Very disappointing.
Please suggest this to your developers and I hope it won't take much time. There is already "for" attribute for the label (you can see it in the code of my first message), it just takes some random value for some reason. Maybe it's just a mistake.
In the meantime, I would really appreciate some solution from you that would help me to achieve the same look as in the screenshot I attached previously.
I took a more detailed look at this and tested a CRED form and it seems that the For attribute is still there and it is reflecting the same ID as the field.
Could you provide me with a link to the page so I can have a look at this new form you created because it works fine on my end.
Thanks for checking it out. The fact that it works for you made me do some tests on my side.
It looks like with
input[type=radio] {display: none !important;}
the form produces wrong "for" attributes for labels. When I remove this styling, the attributes are just right. Not sure how css affects it, but this is what it is. I guess I just have to give them 0 width and height instead of hiding them for the labels to be correct.
Sorry for being hard, but with your answer you made me think that you know about the wrong labels and consider it normal. Plus it was working before the update.