Results 1 to 6 of 6

Thread: Conditions for a valid email address

  1. #1
    Join Date
    Nov 2004
    Posts
    5

    Default Conditions for a valid email address

    Hello Russell, I have a question please on validating an email address. In another thread, you wrote:

    Quote Originally Posted by russellr
    Hi,

    I don't guarantee that this is perfect, but here's a reasonable attempt at checking for valid email address:

    Code:
    <input type="hidden" name="conditions" value=":#
     #TEST#email ~ /^[a-z0-9_.]+@[a-z0-9_]+\.([a-z0-9_.]+)*[a-z0-9_.]$/i #
     Please enter a valid email address.#">
    Hope that helps!
    Would you be so kind as to explain where I put this code? I assume it must go into the .html in my email form, but how would I format it for the formail.php script?

    Many thanks for your kind assistance, js

  2. #2
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Conditions for a valid email address

    Hi,

    It's a hidden field so you just add it to your HTML form. Just like "recipients" and "subject".

    FormMail interprets it automatically.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  3. #3
    Join Date
    Nov 2004
    Posts
    5

    Default Re: Conditions for a valid email address

    Thanks.... so are you suggesting that I merely copy and paste the code into my form and then the script will detect if the email address is not formatted correctly? Is there any other customization of the formail.php script required? As you can tell, I am not a programmer. js

  4. #4
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Conditions for a valid email address

    Hi,

    Yes. There are a few assumptions:
    1. You don't already have a field call "conditions".
    2. You're using a version of FormMail that supports conditions (version 2.00 or above).
    3. Your form currently works properly with FormMail.
    As always, you need to test any change thoroughly.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  5. #5
    Join Date
    Jul 2005
    Posts
    23

    Default Re: Conditions for a valid email address

    There is a bug in that email address checking code. Shouldnt the ending of the code be />

  6. #6
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Conditions for a valid email address

    Hi,

    It's not a "bug" but a question of standards. HTML allows a bare non-paired tag.

    XHTML, however, requires an ending tag or "/>" as a shortcut.

    We almost always try to write XHTML now, so, yes, I should have written:
    Code:
    <input type="hidden" name="conditions" value=":#
     #TEST#email ~ /^[a-z0-9_.]+@[a-z0-9_]+\.([a-z0-9_.]+)*[a-z0-9_.]$/i #
     Please enter a valid email address.#" />
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Don't want to force entering an email address
    By Goji in forum FormMail Subscription Support
    Replies: 10
    Last Post: 22-Jun-2004, 02:54 AM
  2. no valid recipients were specified.
    By SonSon in forum FormMail Subscription Support
    Replies: 3
    Last Post: 08-Apr-2004, 08:27 AM
  3. yet another no valid receipient
    By koocha in forum FormMail Subscription Support
    Replies: 6
    Last Post: 11-Feb-2004, 11:04 PM
  4. No valid recipients
    By Oktopuz in forum FormMail Subscription Support
    Replies: 2
    Last Post: 06-Feb-2004, 06:48 AM
  5. detect valid email sender
    By richardsb24 in forum FormMail Subscription Support
    Replies: 1
    Last Post: 01-Feb-2004, 05:16 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •