Skip navigation
Art of Zen
Currently Being Moderated

Way to Count Email Addresses Entered into a Field

Jun 11, 2012 12:38 PM

I am using Coldfusion 8.0 and have a simple email form with From, To, and Body fields.  I would like to limit the number of entries in the "To:" field to 300 or less.  Is there a function that I can use to do this?  I was thinking  more along the lines of counting the number of "@" charcters in the field and if  301+, then redirect the user.

 
Replies
  • Currently Being Moderated
    Jun 11, 2012 12:40 PM   in reply to Art of Zen

    That would work. But if you want to ensure they are all valid emails, you would need to loop over the items and run isValid on em.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 11, 2012 12:45 PM   in reply to Art of Zen

    GIven that "s" is the variable containing the value, if you did:

     

    <cfset parts = listToArray(s, "@")>

     

    you could then check the length of parts.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points