- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2024 01:35 AM
Hi,
I have a requirement where the following format is only accepted for a field. Kindly help.
rocisw01nfs.unix.rabk.com:/appshares/san
Regards
Suman P.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2024 02:46 AM
@Community Alums Please update your script as follows.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var re = /^[a-z0-9]+.[a-z]+.[a-z]+.[a-z]+:\/[a-z]+\/[a-z]+$/;
if (!re.test(g_form.getValue('nfs_export')) {
g_form.addErrorMessage('Invalid format for NFS Export');
g_form.clearValue('nfs_export');
return false;
}
}
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2024 01:57 AM
Hi @Community Alums
You need to create a regex for this first. You can try with below regex :
([A-Za-z0-9]+(\.[A-Za-z0-9]+)+):/[A-Za-z]+/[A-Za-z]+
You can generate the regex from the below link :
Once done, please follow below post to use it :
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2024 02:04 AM
/([A-Za-z0-9]+(\.[A-Za-z0-9]+)+):\/[A-Za-z]+\/[A-Za-z]+/i;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2024 02:06 AM
@Community Alums
Is your query addressed ? If yes, can you please mark my answer as correct for others to follow.
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2024 02:36 AM
Hi @Amit Verma @Sandeep Rajput ,
I tried both of your suggestions. Thank you, but it is not working. Please correct me.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var re = /^[a-z0-9]+.[a-z]+.[a-z]+.[a-z]+:\/[a-z]+\/[a-z]+$/;
if (!re.test("nfs_export")) {
g_form.addErrorMessage('Invalid format for NFS Export');
g_form.clearValue('nfs_export');
return false;
}
}
It just clears off the value once i enter abc.unix.rgbk.com:/appshares/san
Regards
Suman P.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2024 02:46 AM
@Community Alums Please update your script as follows.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var re = /^[a-z0-9]+.[a-z]+.[a-z]+.[a-z]+:\/[a-z]+\/[a-z]+$/;
if (!re.test(g_form.getValue('nfs_export')) {
g_form.addErrorMessage('Invalid format for NFS Export');
g_form.clearValue('nfs_export');
return false;
}
}
Hope this helps.