- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2016 02:30 PM
I have a variable "Phone" with a mask like "(000) 00000-0000".
It works perfectly on the Fulfiller screen, but now that we are migrating to Service Portal, I've noticed that you cannot use jQuery or DOM on Client Scripts.
Is it possible to put a phone mask on a variable so that it works on the Service Portal?
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2018 12:44 PM
Answering my own question from 2y ago: In order to use jQuery from client scripts on the service portal, you should use this.$ instead of $
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2018 07:30 AM
Hi, I habe the same issue too, any help is highly appriciated.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2018 11:28 PM
Hi Guys,
I have sorted this out now with the a onSubmit Client script (see below).
I am using international number formating and a "-" to seperate the last digits. This is based on the example from here:
Hope this helps you.
function onSubmit() {
g_form.hideAllFieldMsgs('error');
var displayError = 0;
//declare Variables and populate with Values from the Fields
var phone = g_form.getValue('u_phone');
var mobile = g_form.getValue('u_mobile');
var facsimile = g_form.getValue('u_telefax');
var cancleSubmit = false;
//console.log(phone + ' ' + mobile + ' ' + facsimile);
//Check Numbers are correctly entered in the required Mask before checking if the number is taken:
//Check Phone Format Mask +##_(2-4 #)_(3-6#)(-)(1-4#)
var phone_pattern = /^\+(\d{1,3})[\s](\d{2,4})[\s](\d{3,6})[-](\d{1,4})$/;
if(!phone_pattern.test(phone)){
g_form.showFieldMsg('u_phone', 'Phone Number Format does not match requirements - example for valid format +49 201 240588-0', 'error');
displayError = 1;
}
//Check Mobile Phone Mask
if(mobile != ''){
var mobile_pattern = /^\+(\d{1,3})[-|\s](\d{3,4})[-|\s](\d{3,12})$/;
if(!mobile_pattern.test(mobile)){
g_form.showFieldMsg('u_mobile', 'Mobile Phone Number Format does not match requirements example for valid format +49 150 12345678', 'error');
displayError = 1;
}
}
//Check Facsimile Mask
if(facsimile != ''){
var facsimile_pattern = /^\+(\d{1,3})[\s](\d{2,4})[\s](\d{3,6})[-](\d{1,4})$/;
if(!facsimile_pattern.test(facsimile)){
g_form.showFieldMsg('u_telefax', 'Telefax Number Format does not match requirements - example for valid format +49 201 240588-0', 'error');
displayError = 1;
}
}
if(displayError == 1){
return false;
}
console.log('DEBUG:script ended');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2018 12:44 PM
Answering my own question from 2y ago: In order to use jQuery from client scripts on the service portal, you should use this.$ instead of $