Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,021
    Plugin Contributions
    3

    Default Re: Form Validation Javascript!

    in the similar vein, while making changes to create_account I was wondering why the form validation seems to be duplicated in both the php and in the javascript.

    Yes, I'm pretty sure that's why it's duplicated. One of the things I like about Zencart is that it works in all browsers, regardless of the settings the visitor prefers.

    Is it because we still supposed to be looking after people with javascript disabled?

    Only if you want us as customers, I guess.

  2. #2
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,835
    Plugin Contributions
    31

    Default Re: Form Validation Javascript!

    I looked up some stats and at last 6% have Javascript turned off, which is more than I would have thought and a significant number of customers!!

    So to cater for all, one should duplicate the validation, which leads to thinking that although javascript is easily added to a page, unless you want double work in two (programming) languages any validation on extra fields is best done once in php and left at that.

    Why add the extra javascript at all?

    Or am I missing something, as is often the case...

    Steve

  3. #3
    Join Date
    Jul 2009
    Location
    Texas
    Posts
    209
    Plugin Contributions
    2

    Default Re: Form Validation Javascript!

    Quote Originally Posted by torvista View Post
    Why add the extra javascript at all?

    Or am I missing something, as is often the case...
    Steve
    Javascript is run client side whereas php requires you to send the information to the server first. For simple form validation it is often easier on the user and on the server to catch errors before the page is sent.

    That being said javascript can easily be turned off and circumvented so PHP validation is a must.

    Llynix

 

 

Similar Threads

  1. Javascript validation of extra field in create edit account
    By torvista in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 20 Jul 2010, 11:25 PM
  2. Replies: 13
    Last Post: 4 May 2010, 10:47 AM
  3. Javascript validation on product info page - is my JS right ?
    By FuzzyJared in forum General Questions
    Replies: 0
    Last Post: 10 Apr 2007, 07:21 PM
  4. Help with javascript validation error
    By Monster Pawn in forum General Questions
    Replies: 5
    Last Post: 24 Mar 2007, 02:27 PM

Posting Permissions

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