- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 06:24 AM - edited 03-20-2024 06:29 AM
Hi All,
I have created a field called "text" as a yes/no kind of variable so, when user selects the text as yes then we i have through an error meassge.
i have created like this onChange client script field as text
its not working as expected can someone help me here ..
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 07:15 AM
Please validate the backend name of your choices inside dictionary of 'text' field. I am assuming Yes as true and no as false. Below is the script:
function onChangeText() {
var output = g_form.getValue('text');
if (output == 'true') {
g_form.addErrorMessage('Error message: You selected "Yes" for the text field.');
} else {
g_form.clearMessages(); // Clear any existing error messages
}
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 02:54 AM
Form does'nt get submitted for onchage client script, Try using on submit client script.
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 07:51 AM
Please use below code:
var output = g_form.getValue('text');
if (output == 'true') {
g_form.addErrorMessage('Error message: You selected "Yes" for the text field.');
return false; // Prevent form submission
} else {
g_form.clearMessages(); // Clear any existing error messages
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 07:57 AM
hi @Maddysunil
i have applied the same logic but its submitting the form after error message came
Suggest me something please
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 07:49 PM
Could you please share your script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 02:33 AM
Hello @Maddysunil
I have user the bellow code with onchage client script on that field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 02:54 AM
Form does'nt get submitted for onchage client script, Try using on submit client script.
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks