SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru etidd's Avatar
    Join Date
    May 2011
    Location
    atlanta, ga
    Posts
    632
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Talking Recommendations for Processing Email Addresses Entered

    Hello everyone,

    I was wanting to know what you all thought the best technique is to process email addresses entered in my form. Should I do it in JavaScript, or should I have my web server do it -- however that works. It's just a simple 1-field collection.

  2. #2
    SitePoint Guru etidd's Avatar
    Join Date
    May 2011
    Location
    atlanta, ga
    Posts
    632
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I should probably have something that catches if bogus data was entered or if the email entered is valid.

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,871
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    All form field validation MUST be done on the server after the form is submitted. If you don't validate on the server then people can submit garbage in the form and you'd never know.

    Any JavaScript validation added to the form is there simply to make it easier for some of those filling out the form as they can discover mistakes prior to submitting the form. It doesn't prevent people deliberately entering garbage as they can always turn JavaScript off.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Guru etidd's Avatar
    Join Date
    May 2011
    Location
    atlanta, ga
    Posts
    632
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your post, Stephen.

    Anywho, if form field validation MUST be done on the server, how do I invoke that process? Do I need to write any code and post it to my web server somehow?

    Then, when I have data on my web server, how can I extract that data? Do I need a .csv file?

  5. #5
    SitePoint Member
    Join Date
    Jan 2008
    Location
    Ottawa, Canada
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey etldd,

    Your question to Stephen depends on the language you're using. Try searching Google for +form +field +validation +[language you are coding in, for example PHP]. Hope that helps you to learn, there's no way you will effectively learn an answer to your question with a simple response on this forum. Please beware there are likely many more security concerns that you will need to address in your code as well, especially if you store submissions in a database (e.g. SQL injection attack prevention, etc.).

    Cheers,
    Brent
    Last edited by Ted S; Oct 24, 2011 at 23:19.


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
  •