- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2023 10:19 PM
how to restrict value in a single field
It will only accept a number range between 6000000 – 6999999 (8 numeric char).
If not meet, message will appear:
"This task is only relevant for Customers with a number range between 6000000 – 6999999"
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2023 11:14 PM
Did this helped you?
Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2023 10:24 PM - edited 12-10-2023 10:36 PM
Hello @alona3
Please use this client script for the field
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
// Get the current field value
var fieldValue = g_form.getValue('field_name'); // Replace 'your_field_name' with the actual field name
// Define the valid number range
var minNumber = 6000000;
var maxNumber = 6999999;
// Check if the field value is a numeric value within the valid range
if (isNaN(fieldValue) || fieldValue < minNumber || fieldValue > maxNumber) {
// Display an error message
alert('Error! This task is only relevant for Customers with a number range between 6000000 – 6999999');
// Set the field value to an empty string or another default value if needed
g_form.setValue('field_name', ''); // Replace 'your_field_name' with the actual field name
}
//Type appropriate comment here, and begin script below
}
Please check and Mark Correct and Helpful if it really helps you.
Regards,
Prashant Ahire
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2023 10:30 PM
Thank you for quick response.
Is this onChange?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2023 10:35 PM
Yes this is onChange
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2023 10:56 PM
Hello,
thank you so much it works.
Additional question can i add link in the error message?
Message:
This task is only relevant for Customers with a number range between 6000000 – 6999999.
All other customers can be reactivated using the following instruction: LINK
In case of any problems, please do not hesitate to contact CIT