How can I get a variable label text?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2016 08:12 PM
Hi everyone ,
I'm trying to get the Label text of a radio button and a check box once they are clicked, then after that they will be captured in a multi line text and etc..
I'm trying to use
g_form.getLabel('my_checkbox');
g_form.getLabel('my_radio_button');
But this doesn't seem to work, I'm trying to capture them when user is filling out a catalog item, the code just throw "false" as a value instead of the label text, has anyone know how to get the label text dynamically? I could do a conditional state which will put the value of the label to a variable but this will be hard coded and I'm not positive whit that idea.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2016 09:17 PM
Hi,
Not sure in which release you are in. Did you try using
g_form.getLabelOf("my_checkbox")
using getLabelOf instead of getLabel should work.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2016 11:56 PM
Hi
Please try with below line.in that u have to find out the id of the field.
var x = document.getElementById("ID of ur field").label;
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2016 06:25 AM
Hi,
Thanks for your suggestions but none of them worked, I got a "null" response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2016 01:12 AM
Hello,
Try doing the following:
var labelElement = $('label.' + g_form.getControl(field).id);
Best regards,
Brian