
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2015 02:51 PM
Hi Community,
I need to change the label of a question in a catalog item depends of the option the user choose in a Select Box, I want to use the same field to capture the information and do not create a lot of fields to do the same function.
I created a Catalog Client Scripts and tried with g_form.setLabelOf but it is not working.
var varValue = g_form.getValue('subcategory'); |
if(varValue== '2'){
g_form.setLabelOf('specifySubCategory', 'New Value')'); |
}
Do you know any other way to make this change?
Regards,
Juan
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2015 02:45 AM
Try
jQuery("label[for='"+g_form.getElement('user').id+"']").html("YourText");
Replace user with your variablename

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2015 02:21 AM
Should be possible since the ID of the element will remain the same ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2017 11:09 PM
Kalai,
the solution you given is not working for multiple choice field. any Idea?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2023 09:23 AM
Hello,
Thank you, it works perfectly in the Service Catalog:
However, it does not work on the Portal:
(g_env) [SCRIPT:EXEC] Error while running Client Script "": TypeError: Cannot read properties of undefined (reading 'id')
Could anyone of help me? Can it be modified so that it is functional on the Portal, too?
Thank you and Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2024 02:16 AM
For anyone interested there is an error in line:
g_form.setLabelOf('specifySubCategory', 'New Value')');
Correction:
g_form.setLabelOf('specifySubCategory', 'New Value');
I applied this change in my use case, and it worked on SP.
Regards,
Dom