cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
8455
Views
34
Helpful
0
Comments
Jason Kunst
Cisco Employee
Cisco Employee

To protect your self-registration users from entering the wrong domain when entering their sponsor (person being visited) email address you can use the following script

 

For more information on working with javascript check out this document and watch the video sample

How To: ISE Web Portal Customization Options

This video shows you in an example on the sponsor portal page

 

This code is placed in the Optional Content 2 area of the Self-registration page when under the HTML editor (far right on the actions bar):

<script>
 
     setTimeout(function(){
 
          $.validator.addMethod("customemailvalidator", function(value, element) {
 
       return /^(\w+\.?)+@example\.com$/.test( value );
 
     }, 'Please enter a valid email.');
 
     jQuery("[name='guestUser.fieldValues.ui_person_visited']").rules("add",{customemailvalidator:true});
 
     }, 50);
 
</script>

You can change orange string on your email domain. For example: "foo\.com", "bar\.gov"

 

Screen Shot 2016-09-01 at 11.50.16 AM.png

 

Thanks to Igor Poble for this one, it allows multiple '.'

Example xxx.yyy@domain.com or xxx.yyy.zzz@domain.com.

<script>

     setTimeout(function(){

          $.validator.addMethod("customemailvalidator", function(value, element) {

       return /^(\w+\.?)+@cisco\.com$/.test( value );

     }, 'Please enter a valid email.');

  

     jQuery("[name='guestUser.fieldValues.ui_person_visited']").rules("add",{customemailvalidator:true});

     }, 50);

</script>


 

From paul@berbee

I ended up simplifying the Java script Regex to only check for "@example" to allow for @example.com, @example.co.jp, etc.  You don't need the Regex to validate the entire email format because the form already has Regex built in to ensure proper email format is specified.  Here is what I ended up using:

 

<script>

     setTimeout(function(){

          $.validator.addMethod("customemailvalidator", function(value, element) {

       return (/@example/).test( value );

     }, 'Please enter a valid Example email address.');

  

     jQuery("[name='guestUser.fieldValues.ui_person_visited']").rules("add",{customemailvalidator:true});

     }, 50);

</script>

 

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: