- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2022 03:43 AM
I have made the Duration type variable Mandatory. There are two issues here:
1. On the Service Portal view, the Duration type field is accepting '0' number and becoming non-mandatory.
Before :
After:
2. Duration type field is accepting alphabets while placing order
I have tried onChange client scripts for point 2, but nothing is working.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2022 06:37 AM
The Time duration field returns 00 00:00:00 even when we don't give any value. I have written the below OnSubmit client script and it works.
function onSubmit() {
//Type appropriate comment here, and begin script below
var value = g_form.getValue("time_duration");
var day = value.split(" ");
var time = day[1].split(":");
var counter = 0;
if (day[0] > 0)
return true;
else {
for (var i = 0; i < 3; i++) {
if (time[i] > 0)
return true;
else
counter++;
}
}
if (counter > 0) {
alert("Enter the right Time Duration value!");
g_form.clearValue("time_duration");
return false;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2022 11:47 AM
Hi
If mandatory doesn't work, you can try using onSubmit client script here, your condition could be something as:
if(g_form.getValue("time_duration_backend_name") == ''){
g_form.showFieldMsg("time_duration_backend_name", "No duration value filled!", "error");
}
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2022 06:37 AM
The Time duration field returns 00 00:00:00 even when we don't give any value. I have written the below OnSubmit client script and it works.
function onSubmit() {
//Type appropriate comment here, and begin script below
var value = g_form.getValue("time_duration");
var day = value.split(" ");
var time = day[1].split(":");
var counter = 0;
if (day[0] > 0)
return true;
else {
for (var i = 0; i < 3; i++) {
if (time[i] > 0)
return true;
else
counter++;
}
}
if (counter > 0) {
alert("Enter the right Time Duration value!");
g_form.clearValue("time_duration");
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2025 10:43 PM
hi @Revathi10 , @Aman Kumar S
When the user is submitting the catalog by giving data, hours value in the Duration variable, it showing some wired numeric value.
Can you help me to fix it?