showFieldMsg is not working in workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-23-2024 11:55 PM
Hi,
I'm trying to show field msg in workspace using g_form.shoFieldMsg() after clearing the value, the value is getting cleared but the message stays for a fraction of second and disappears. Please suggest how to fix this issue.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-26-2025 08:30 AM
Thanks again @uttkarshupa , do you have syntax example for 'persist' option?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-26-2025 09:22 AM
You're welcome, hereās how you can use the persist option:
g_form.showFieldMsg('u_test', 'Please enter a valid value', 'error', false);
[Here, false keeps the message persistent]
This will keep the message visible until you decide to clear it with g_form.clearFieldMsg() or based on some other condition. If version doesnāt support persist, you might have to manage the visibility manually.
Hope this helps, and if it works for you, a thumbs up would be awesome.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-26-2025 11:44 PM
@uttkarshupa Thanks you very much for your assistance! ithe message is still not stay even I've added false in the end of the g_form.showFieldMsg function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-27-2025 05:25 AM
Thanks for the update, If adding false to the g_form.showFieldMsg() still isn't working, it might be a version issue or something specific to the Workspace itself. Sometimes, certain configurations or customizations in the Workspace can cause unexpected behavior.
As a workaround, you can manually keep the message visible by ensuring no refresh or form re-rendering is happening after you show the message. You could try this:
1) Use setTimeout() to delay any field clearing or form changes after showing the message.
2) Or, you could try g_form.clearFieldMsg() only when you're ready to manually remove the message.
If this still doesn't work, it might be a backend issue or something deeper in the form rendering process.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-27-2025 07:57 AM
Thank you @uttkarshupa , I apperciate it! I've made a combination of what you suggested and it solved the issue:
var emailPattern = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
if (!emailPattern.test(newValue)) {
g_form.clearValue('run_email');
setTimeout(function() {
g_form.hideFieldMsg('run_email');
g_form.showFieldMsg('run_email', 'Please enter a valid email address (i.e. name@company.com).', 'error');
}, 500); // Delay of 500 milliseconds