A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] restricting input text when a @ sign is not present

  1. #1
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389

    resolved [RESOLVED] restricting input text when a @ sign is not present

    Hi,

    I'm looking for a tutorial where this would be explained. Obviously for an email input field to have the user rewrite it.

    Thanks for any suggestions

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi Cap,

    I think you are looking for a mail form basically, with email check function, maybe tyry this simple example.

    2 text fields, Email.text / Errors.text
    1 button, sendButton

    code:
    PHP Code:
    // *** text fields
    Errors.text "";
    Email.text "";
    // *** check valid email
    function Validate(address)
    {
        if (
    address.length >= 7)
        {
            if (
    address.indexOf("@") > 0)
            {
                if ((
    address.indexOf("@") + 2) < address.lastIndexOf("."))
                {
                    if (
    address.lastIndexOf(".") < (address.length 2))
                    {
                        return (
    true);
                    }
                }
            }
        }
        return (
    false);
    }
    // ** check all form details then send
    function FormCheck()
    {
        if (
    Email.text.length 1)
        {
            
    Errors.text "Please enter an E-Mail.";
        }
        else if (!
    Validate(Email.text))
        {
            
    Errors.text "Please enter a valid E-Mail.";
        }
        else
        {
            
    Errors.text "E-mail good to go";
            
    // now send the mail code
        
    }
    }
    // *** send button
    sendButton.onRelease FormCheck

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center