08-24-2023 01:19 AM
Hi,
On the BYOD portal/Device information page I have changed the "Description" Label to "Email Address".
Users should enter their Email address in this field and I need a script under Optional content 2 that will verify the text as being a valid email address.
This script works well on the Guest Self Registration page but doesn't want to work on the BYOD page:
setTimeout(function(){
$.validator.addMethod("customemailvalidator", function(value, element) {
return /^[^@\s]+@example.com$/i.test(value);
}, 'Please enter a valid email address.');
jQuery("[name='guestUser.fieldValues.ui_person_visited']").rules("add",{customemailvalidator:true});
}, 50);
Looking at the BYOD portal i see the following:
But the script doesn't work. I am not a jQuery expert, i have changed the name to device.description, but still nothing.
Can someone tell me what is wrong with it? What i need to change?
Thanks,
Laszlo
Solved! Go to Solution.
08-24-2023 06:28 AM
- Try to change the selector to jQuery("[name='device.email_address']". The updated script will look like this:
setTimeout(function(){
$.validator.addMethod("customemailvalidator", function(value, element) {
return /^[^@\s]+@example.com$/i.test(value);
}, 'Please enter a valid email address.');
jQuery("[name='device.email_address']").rules("add",{customemailvalidator:true});
}, 50);
M.
08-24-2023 06:28 AM
- Try to change the selector to jQuery("[name='device.email_address']". The updated script will look like this:
setTimeout(function(){
$.validator.addMethod("customemailvalidator", function(value, element) {
return /^[^@\s]+@example.com$/i.test(value);
}, 'Please enter a valid email address.');
jQuery("[name='device.email_address']").rules("add",{customemailvalidator:true});
}, 50);
M.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide