Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
"data-field-reference" attribute for radio buttons and checkboxes
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
Feature Request Created: https://liferay.atlassian.net/browse/LPD-26323
Hi Tobias, please see https://liferay.atlassian.net/browse/LPD-26323 for an update. Can you provide the requested information?
Powered by Liferay™