osCmax v2.5 User Manual
Results 1 to 7 of 7

form_check.js.php needed everywhere?

This is a discussion on form_check.js.php needed everywhere? within the osCmax v2 Installation issues forums, part of the osCmax v2.0 Forums category; I was trying to optimize a little bit my web/cleaning out html code, and I just noticed that on /templates/whatever/main_page.tpl.php ...

      
  1. #1
    Active Member MindTwist's Avatar
    Join Date
    Jun 2007
    Location
    Barcelona, Spain
    Posts
    409
    Rep Power
    7


    Default form_check.js.php needed everywhere?

    I was trying to optimize a little bit my web/cleaning out html code, and I just noticed that on /templates/whatever/main_page.tpl.php we are calling:

    Code:
    <?php require('includes/javascript/form_check.js.php'); ?>
    So we are adding the form check code on every page on our web site. Yeah, I know it won't hurt, but besides adding on my case almost 5k of code to every served page, it looks quite ugly to see all that code on pages pages that have nothing to do with it.

    Has anyone bothered trying to move it only to the files where it is actually needed? Like

    /templates/whatever/content/account_edit.tpl.php
    /templates/whatever/content/account_password.tpl.php
    ...

    Am I being too picky here? (yeah, I know I am wasting my time)

  2. #2
    Lurker
    Join Date
    Sep 2005
    Posts
    3
    Rep Power
    0


    Default Re: form_check.js.php needed everywhere?

    I was wondering the same - too bad no one replied. I did not see this check in the standard OSC installation and I certainly feel my site is a little slower. Can it be removed, at least, from the most visited pages such as product listings and home page?

    Thanks
    Ari

  3. #3
    Active Member MindTwist's Avatar
    Join Date
    Jun 2007
    Location
    Barcelona, Spain
    Posts
    409
    Rep Power
    7


    Default Re: form_check.js.php needed everywhere?

    I never bothered giving it a try myself.. Maybe it could be removed from main_page.tpl.php and put just where it is needed, I guess when you are creating an account, when you are adding/changing addresses, when checking out with PWA... I should check out exactly on what places it is used, but since it is just a matter of optimization and nothing that will make the store go better, I left it there.

    Michael_s, come on... we are awaiting your answer!

  4. #4
    Lurker
    Join Date
    Sep 2005
    Posts
    3
    Rep Power
    0


    Default Re: form_check.js.php needed everywhere?

    Well, I just removed it from the main template to test and nothing bad happened. I think the site is a little faster, but the function is not visible anymore anywhere when viewing the source, not even the login page... I tested create account and checkout without problems and I am still getting the js error messages if i leave a field empty. Hope Michael will chip in

  5. #5
    Active Member MindTwist's Avatar
    Join Date
    Jun 2007
    Location
    Barcelona, Spain
    Posts
    409
    Rep Power
    7


    Default Re: form_check.js.php needed everywhere?

    Well, I'll be damned...

    It does indeed work when removing it. But form_check.js takes care of validating the input before it gets send to the server. Without it, the data gets sent to your store, and then it will return an error when needed. So it is just one more layer of checking user input.

    But, what gets me... When removing it, I only found it missing from create_account. When I was editing an address on address_book, the javascript code was there. On account_edit, it was also there... what the #@%??

    So I looked a little bit around and found that you can add javascript code to any page just by adding one line of code on the main php file. You want form_check.js added on create_account.php ? Edit it, and right after:

    Code:
      $content = CONTENT_CREATE_ACCOUNT;
    Add:

    Code:
      $javascript = 'form_check.js.php';
    I must say that I had never before even looked at what was inside /includes/javascript.

    So, I removed form_check.js.php from main_page.tpl.php and added that line on create_account.php, and everything seems to be working exactly as it was before. address_book.php and account_edit.php already had the javascript added on them, and I also had to add it to Order_Info.php which is used by PWA mod (Purchase Without Account)

    I am not sure if I am missing more places, but if I do I will report back.

    So, after all, it seems that those 5k of javascript code are not needed on every single page on the store after all, they are only needed on 4 places, so it can be removed everywhere else. I have implemented it on my test store, but I think the change will go quite soon to my live store.

  6. #6
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    Default Re: form_check.js.php needed everywhere?

    The templates have never been optimized for sure, and a lot of the code in them is left over from earlier versions of BTS that were not as flexible.

    This is a great way to start, cleaning up code from the main template that doesn't really need to be there, and putting it in the content, only where it needs to be.
    Michael Sasek
    osCMax Developer


    osCmax Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  7. #7
    Active Member MindTwist's Avatar
    Join Date
    Jun 2007
    Location
    Barcelona, Spain
    Posts
    409
    Rep Power
    7


    Default Re: form_check.js.php needed everywhere?

    From what I saw yesterday, the places where form_check.js is needed are:

    account_edit
    account_password
    address_book
    create_account
    Order_Info

    Three of those files already had it included. It was a matter of removing it from main_page, and adding it to the other two that need it

Similar Threads

  1. A little help needed
    By blain in forum osCommerce 2.2 Modification Help
    Replies: 1
    Last Post: 06-02-2005, 11:13 AM
  2. Contribution help needed
    By rupak in forum osCommerce 2.2 Modification Help
    Replies: 1
    Last Post: 01-28-2005, 05:42 AM
  3. UPS XML Contribution Help Needed!?!?
    By handysf in forum osCmax v1.7 Discussion
    Replies: 0
    Last Post: 02-20-2004, 04:38 AM
  4. Is this the correct file name? form_check.js.php
    By MintMoney in forum osCmax v1.7 Discussion
    Replies: 0
    Last Post: 11-04-2003, 04:52 PM
  5. error in my form_check.js.php maybe???
    By oakleaf in forum osCommerce 2.2 Modification Help
    Replies: 0
    Last Post: 10-31-2003, 01:19 PM

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
  •