Next Experience UI Base on Check box selection show/hide text area using script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2025 06:47 PM
Hi,
I have page with check box and text area named textarea_1, based on the check box selection show/hide text area using checkbox event. using below script in the event, but its not hiding the textarea when I uncheck the checkbox. How to fix this script?
/**
* @Param {params} params
* @Param {api} params.api
* @Param {any} params.event
*/
function evaluateEvent({
api,
event
}) {
console.log(event.payload.value);
api.setState("textAreaShow", event.payload.value);
if (api.update) {
api.update();
}
return {
propName: "textarea_1",
value: event.payload.value
};
}
I also tried with textAreaShow client state parameter still its not working.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2025 11:00 AM
Hello,
I believe you can achieve similar with a simple Client Script.
- Create new Client Script
- Table: <Record's table>
- UI Type: All
- Type: onChange
- Field Name: <Checkbox name>
- Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue === 'true') {
g_form.setVisible('textarea_1', true);
} else {
g_form.setVisible('textarea_1', false);
}
}
If you want to run this Client Script only in Workspace, uncheck Global checkbox and write form view names into the field.
If my answer helped you, please mark it as correct and helpful, thank you 👍
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2025 03:37 PM
This is Core UI script, I am looking script for Next Experience UI form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 06:06 AM
I understand. I tested this script in Service Operations Workspace and it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 06:32 AM
My Check box is UI component, its not table filed. So I can't add the client script like above.