- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 08:37 AM
Hi All,
I'm looking for some advice on how to achieve a dynamic field label. The field is an integer representing distance, I personally read distance in Miles, but this is obviously not a global preference. I've created a system property that handles the conversion from Miles -> Km and Km -> Miles. What I would like to do then is update the field label to read "Distance (Km)" or "Distance (Miles)" depending on the current sys_property value.
I know that a label CAN be change with client side script, weather it should be is another matter, thinking DOM manipulation best practice etc.
I know that the value of a property can be captured with a getProperty, but cannot use gs. in client side scripting......
How would others approach this?
Solved! Go to Solution.
- Labels:
-
Scoped App Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 08:44 AM
To capture the property, You need to write a display business rule and save it in a g_scratchpad variable.
In your display BR, add the following script
g_scratchpad.my_property = gs.getProperty('property_name');
And in your client script
g_form.setLabelOf('field_name', g_scratchpad.my_property);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 08:41 AM
Hello Alex,
You can do it using the Glide Form API on the client side using setLabelOf function()
g_form.setLabelOf('field_name', 'Your Lable here');
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 08:42 AM
sounds good, still wondering about getting the value of the property
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 08:44 AM
To capture the property, You need to write a display business rule and save it in a g_scratchpad variable.
In your display BR, add the following script
g_scratchpad.my_property = gs.getProperty('property_name');
And in your client script
g_form.setLabelOf('field_name', g_scratchpad.my_property);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 08:53 AM
This is what i'm working towards at the moment after reading a post from Chuck.
I still have some concerned that this will be checking against the property and updating the label each time the tables is queried. This essentially voids the purpose of setting a system property (to avoid repeated checks and actions).