- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2025 11:21 PM
Hello Team,
I have implemented the validation for the update set naming convention, and everything is working fine. However, when a user submits the form with a name that does not follow the convention, the validation message appears but disappears within a second.
I would like the message to remain visible for at least 10 seconds to ensure the user has enough time to read it. How can I achieve this?
I have attached my onLoad and onSubmit client scripts for reference.
Onload Client Script:
function onLoad() {
var fn=g_user.firstName;
var ln=g_user.lastName;
var fv=fn.charAt(0);
var fv2=ln.charAt(0);
if(g_form.isNewRecord())
{
g_form.setValue('name',"PN-"+fv+fv2+"-"+"STR");
}
}
onSubmit client script
function onSubmit() {
var name = g_form.getValue('name');
alert("Onsubmit"+name);
// Define the required pattern: <Project Prefix>-<User Initials>-<Story>
var pattern =/^[A-Z]{2,3}-[A-Z]{2}-STR\d+$/;
if (!pattern.test(name)) {
g_form.addErrorMessage("Invalid Update Set name! Follow the naming convention: Project Prefix-User Initials-Story(e.g., FN-MI-STR00011)");
location.reload();
return false;
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2025 01:05 AM
Hi @Mark Wood
Then just use the same logic in the OnSubmit client script instead of reloading the form.
function onSubmit() {
var name = g_form.getValue('name');
alert("Onsubmit" + name);
// Define the required pattern: <Project Prefix>-<User Initials>-<Story>
var pattern = /^[A-Z]{2,3}-[A-Z]{2}-STR\d+$/;
if (!pattern.test(name)) {
g_form.addErrorMessage("Invalid Update Set name! Follow the naming convention: Project Prefix-User Initials-Story(e.g., FN-MI-STR00011)");
setTimeout(function() {
g_form.clearValue("name");
g_form.clearMessages();
var fn = g_user.firstName;
var ln = g_user.lastName;
var fv = fn.charAt(0);
var fv2 = ln.charAt(0);
if (g_form.isNewRecord()) {
g_form.setValue('name', "PN-" + fv + fv2 + "-" + "STR");
}
}, 10000);
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2025 01:12 AM
this should be the ideal way to check it