Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2008
    Posts
    2
    Plugin Contributions
    0

    Default Form Validation Javascript!

    Hello,

    Can someone please tell me which file to edit for the javascript form validation code for new accounts?

    I found it in this file:
    modules/pages/create_account/jscript_form_check.php

    But that wasn`t the one. Nothing happened after I changed it. So, then I found it in this file:
    includes/form_check.js.php

    But again, after editing, nothing happened. I thought it might be being cached, but no joy there either.

    Is it in some other file?

    Many thanks,
    David.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Form Validation Javascript!

    For new accounts via the "create_account" page, you were correct in looking at this one:
    modules/pages/create_account/jscript_form_check.php

    However, if the "new account" was created via the "login" page, you'll need to make the same edits to the jscript file in the login page folder:
    modules/pages/login/jscript_form_check.php

    Related FAQ: http://www.zen-cart.com/wiki/index.p...s_-_Javascript
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Apr 2008
    Posts
    2
    Plugin Contributions
    0

    Default Re: Form Validation Javascript!

    Superb. That was it. Many thanks for your time DrByte. :)

  4. #4
    Join Date
    Aug 2009
    Posts
    1
    Plugin Contributions
    0

    Default Re: Form Validation Javascript!

    Thanks DrByte!

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

    Default Re: Form Validation Javascript!

    Hi,
    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.
    If the fields pass the javascript, the red error messages from the php wont get shown/are redundant.

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

    thanks in advance,
    Steve

  6. #6
    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.

  7. #7
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,829
    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

  8. #8
    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