- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2019 06:41 AM
how can i set the percentage field which allows only below 100 numbers in the percentage field.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2019 07:42 AM
You can make an OnChange Client script that validates the value is what you are expecting.
Here is an example of the script I used.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue > 100){
g_form.setValue('percent_complete', 100);
g_form.showFieldMsg('percent_complete', 'Percent complete must be between 0 - 100.','error', false);
}
if(newValue < 0){
g_form.setValue('percent_complete', 0);
g_form.showFieldMsg('percent_complete', 'Percent complete must be between 0 - 100.','error', false);
}
}
Create the script on change of the percentage field you have.
Check the newValue to ensure it is what you want and then do what you would like to the field.
I set it to zero if it was below zero and to 100 if it was over 100 but you can set it to empty if you would like.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2019 07:42 AM
You can make an OnChange Client script that validates the value is what you are expecting.
Here is an example of the script I used.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue > 100){
g_form.setValue('percent_complete', 100);
g_form.showFieldMsg('percent_complete', 'Percent complete must be between 0 - 100.','error', false);
}
if(newValue < 0){
g_form.setValue('percent_complete', 0);
g_form.showFieldMsg('percent_complete', 'Percent complete must be between 0 - 100.','error', false);
}
}
Create the script on change of the percentage field you have.
Check the newValue to ensure it is what you want and then do what you would like to the field.
I set it to zero if it was below zero and to 100 if it was over 100 but you can set it to empty if you would like.