Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1094871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:02:07+00:00 2026-05-17T00:02:07+00:00

I have created a add email method (jquery) to validate a multiple emails for

  • 0

I have created a add email method (jquery) to validate a multiple emails for recipient text box. it’s working fine when prototype.js is not declared on the page. To get rid of the $ conflict i also incorporated the $ noconflict() method measure measure. The other field validations are working in this scenario, except the receipient email validation field. AS per my finding “jQuery.validator.methods.email.call(this, value, element)” line no 50 of the page is not working and hence the method is not firing . I need to call the prototype.js as well. Please see the following code for a clearer understanding…….Thanks in advance.

Please see the code below:

Multi Email Validation

var JQ = jQuery.noConflict();
JQ(document).ready(function() {

  // Handler for .ready() called.
JQ("#email-form").validate({
            rules : {
                email : {
                    required : true,
                                    email : true
                },
                            recipientEmail : {
                    multiemail: true,
                                    required : true
                            //      email : true
                                    }
            },
                    messages: {
                email: {
                    required: "Please enter your email address.",
                                    email: "Please enter a valid email address"
                 },
                             recipientEmail: {
                                    multiemail: "One or more of your recipient email addresses needs correction.",
                                    required: "Please enter the recipient's email address."
                                    //email: "Please enter a valid email address"
                }
            }
        }); 
});

JQ.validator.addMethod(“multiemail”, function(value, element) {
if (this.optional(element)) // return true on optional element
return true;
// var emails = value.split( new RegExp( “\s*,\s*”, “gi” ) );
var emails = value.split( new RegExp( “\s*,\s*”, “gi” ) );

       valid = true; 
               maxEmaillength = emails.length;
       for(var i in emails) 
            {
         value = emails[i]; 
         valid = valid && jQuery.validator.methods.email.call(this, value, element);
                     // Maximum email length validation
                       if(maxEmaillength > 5)
                               {
                                       JQ('label.error:first').html("Please enter only 5 mail IDs at a time");
                                       JQ('label.error:first').css(display, block);                            
                                       setTimeout(alert("Please enter only 5 mail IDs at a time"), 5);
                            }       
        } 
        return valid; 
                    }, 'One or more email addresses are invalid');

</head>
<body>
<form action="" method="get" name="email-form" id="email-form">
<label for="email">email</label>
<input type="text" name="email" id="email" style="width:200px" />
<br />
<label for="recipientEmail">Recipient Email</label>
<input type="text" name="recipientEmail" id="recipientEmail" style="width:500px" /><br />

<input type="submit" name="Submit" id="Submit" value="Submit" />
</form>
</body>
</html>
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:02:08+00:00Added an answer on May 17, 2026 at 12:02 am

    I have just change the approach a little bit, as jQuery.validator.methods.email.call(this, value, element) was not working in the previous custom method. Although i could not find the exact reason, why that was not working with prototype.js and what the exact solution for that problem. But the following code snippet is working as desired. Just replace that previous jquery custom email method with the following one.

    function validateEmail(field) {
        var regex=/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i;
        return (regex.test(field)) ? true : false;
    }
    
    JQ.validator.addMethod("multiemail", function(value, element)
    {
        var result = value.split(",");
        for(var i = 0;i < result.length;i++)
        if(!validateEmail(result[i]) || result.length > 5) 
        return false;               
        return true;                                                       
    
    },'One or more email addresses are invalid');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a add input field function which is working fine. I would
The Outlook add-ins I have created using Visual Studio 2005 don't use the ClickOnce
I have created a Dynamic View Panel custom control and want to add a
I have created a WebPart. When I add the WebPart to a page I
I have created blank C#/XAML Windows 8 application. Add simple XAML code: <Page x:Class=Blank.MainPage
I have created several styles for font in my app. How can I add
I have created the DateTimePicker control. Now i want to add localization Support with
I am attempting to add some entities that I have created. When I try
I am using the new System.Web.Optimization and have created a bundle like this: bundles.Add(New
I have a view called send_confirmation email - which basically sends emails. I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.