Skip Navigation

[Resolved] radio button labels are improperly linked to inputs when under condition

This support ticket is created 7 years, 3 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.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by Beda 7 years, 1 month ago.

Assisted by: Beda.

Author
Posts
#561357

A weird thing happens.

This is good radio button:

<input id="form-140068535" name="wpcf-trip-finance-person-relation" value="child" class="wpt-form-radio form-radio radio radio" data-wpt-type="radio" data-wpt-id="cred_form_79_1_form-140068535" data-wpt-name="wpcf-trip-finance-person-relation" type="radio">
<label class="wpt-form-label wpt-form-radio-label" for="form-140068535">label</label>

And this is how it looks when I put it into [cred_show_group]:

<input id="form-1880937662" name="wpcf-trip-finance-person-relation" value="child" class="wpt-form-radio form-radio radio radio" data-wpt-type="radio" data-wpt-id="cred_form_79_1_form-1880937662" data-wpt-name="wpcf-trip-finance-person-relation" type="radio">
<label class="wpt-form-label wpt-form-radio-label" for="8998">ילד/ה</label>

Look at the 'for' attribute of the label.

This breaks my custom styling which is based on hiding inputs and styling labels instead...

#561483

I am not sure how to achieve this issue.

It's not happening locally, but I am also not so sure how you produce that HTML.

Can you please show me the exact steps you take?
If all it needs is adding the HTML to the form, and wrapping it to the condition, then I cannot confirm this issue.

If it needs some Types Fields, and you mention only the produced HTML above, then I need to know what Field you use, how it's set up, how it's inserted and how the conditions is triggered, as also witht this case I am not able to replicate this problem.

#561517

This is radio custom field of course, not something manually generated:

	<div class="form-group radios">
		<label>מי מממן את הנסיעה שלך ?</label>
		[cred_field field='trip-paid-by' post='application' value='' urlparam='' output='bootstrap']
	</div>

[cred_show_group if="($(trip-paid-by) eq  'company' )"  mode='fade-slide']
	<div class="form-group">
		<label>הקשר של החברה/ארגון אליך</label>
		[cred_field field='trip-finance-company-relation' post='application' value='' urlparam='' output='bootstrap']
	</div>
[/cred_show_group]

#561521

I see.

I duplicated such a scenario and can confirm the issue.

Labels of Radios wrapped in a Conditional are stripped of the "form" prefix in the "for" attribute and use a completely different ID (number)

I reported this as a BUG, thank you for the heads up!

#576466