RE: RE: "data-field-reference" attribute for radio buttons and checkboxes

Jamie Sammons, modified 1 Year ago. New Member Posts: 3 Join Date: 11/1/22 Recent Posts

In a Liferay Form, when I add radio buttons or checkboxes, I want to address their html elements using JavaScript.

Currently, only the auto-generated id is used as "value" attribute, but it is hard to write code for these, because they are randomized and not shown anywhere within the form editor of the Liferay Admin UI.

So, my request is: please add the attribute "data-field-reference" to the html elements of radio buttons and checkboxes, as this is already done with text input fields: 

 

<input name="_com_liferay_dynamic_data_mapping_form_web_portlet_DDMFormPortlet_INSTANCE_gLyPVFmXaC1O_ddm$$Radio08298306$JsAb3n12$0$$de_DE_0" class="custom-control-input" role="radio" type="radio" value="Option66356490" data-field-reference="Option1FieldReference">

Then it would be easily possible to address these html elements using JavaScript:

document.querySelectorAll('[data-field-reference="Option1FieldReference"]')[0]

Best,

Tobias

thumbnail
Jamie Sammons, modified 1 Year ago. Expert Posts: 367 Join Date: 9/5/14 Recent Posts

Feature Request Created: https://liferay.atlassian.net/browse/LPD-26323

thumbnail
Jamie Sammons, modified 1 Year ago. Expert Posts: 367 Join Date: 9/5/14 Recent Posts

Hi Tobias, please see https://liferay.atlassian.net/browse/LPD-26323 for an update.  Can you provide the requested information?