Gravity-Forms-Multiple-Form-Instances icon indicating copy to clipboard operation
Gravity-Forms-Multiple-Form-Instances copied to clipboard

Fix input choice id replacement

Open ajoah opened this issue 2 years ago • 0 comments

Hi,

The commit https://github.com/tyxla/Gravity-Forms-Multiple-Form-Instances/commit/54628395afea01f252a4f3d3197914cb5f361287 breaks connection between label and input for choice fields.

Result :

<li class="gchoice gchoice_4_9_1">
	<input name="input_9" type="radio" value="par email" id="choice_1991267731_9_1">
	<label for="choice_1991267731_4_9_1" id="label_1991267731_4_9_1">par email</label>
</li>

id and for are not equal.

This PR fixes the issue.

However, i don't understant why the replacement is twice in the code :

			"for='choice_"                                                  => "for='choice_" . $random_id . '_',
			"id='label_"                                                    => "id='label_" . $random_id . '_',
			"id='choice_"                                                    => "id='choice_" . $random_id . '_',
			"for='input_" . $form['id'] . '_'                               => "for='input_" . $random_id . '_',
			"id='input_" . $form['id'] . '_'                                => "id='input_" . $random_id . '_',
			"id='choice_" . $form['id'] . '_'                               => "id='choice_" . $random_id . '_',

Only one group of these lines is necessary, no ?

ajoah avatar Oct 07 '22 11:10 ajoah