Results 1 to 10 of 11

Hybrid View

  1. #1
    Join Date
    Sep 2012
    Posts
    253
    Plugin Contributions
    0

    Default Trouble adding some javascript

    I am trying to add google address autocomplete to my site's create account page. I have the javascript code source getting pulled from the jquery_create_account.js file and using page source I can see it loading and have the autocomplete box displayed. However it is not populating anything when I start typing in an address using safari, chrome or firefox. All of the browsers show I am getting an "uncaught Reference error: google is not defined" How would I go about fixing this? At this point I have simply copied the api code into the javascript file and haven't made any changes to populate the correct fields so there are no errors outside of zen-cart. I tried it on another test form I created not the example one provided and it works perfectly so it's just not playing nicely with zen-cart.
    You may see the error at https://onlineorder.sshorepizza.com/...ain_page=login

    The google autocomplete field is is the third one down that says please don't use this section yet. (This isn't a public site.)

    Thank you for your guidance.

  2. #2
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Trouble adding some javascript

    Link didn't "copy" properly...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Sep 2012
    Posts
    253
    Plugin Contributions
    0

    Default Re: Trouble adding some javascript

    moved a couple things around now the error is on autocomplete.setBounds view here.

  4. #4
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Trouble adding some javascript

    FYI, reported that there is a certificate error... Don't know if google has made that part of their process and could be an issue, but thought worth mentioning possibly.

    Couple of other things, looks like there are some other errors on the page that could/might affect the javascript from running. There are two instances of <body tags on the page. One at line 633 and the other at 818.

    Got an undefined result when attempting to use the code contained within the if statement.

    Seeing the duplicate body tag, perhaps the onload code should be moved up to where the body tag was first called.

    What is currently line 633:

    Code:
    <body id="loginBody"onload="update_zone(document.create_account); update_zone_shipping(document.create_account);">
    
    To be made to:

    Code:
    <body id="loginBody"onload="update_zone(document.create_account); update_zone_shipping(document.create_account); initialize();">
    
    Might take a smidge to find exactly where to put that, but...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Trouble adding some javascript

    Yeah, actually I get it now, looks like your initialize function is never called... Not sure if there is some other javascript error, but probably should move the initialize function ahead of the other onload operations...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Sep 2012
    Posts
    253
    Plugin Contributions
    0

    Default Re: Trouble adding some javascript

    thank you. I found it in includes/modules/pages/login/onload_login.js Between your help and Lat9 I have it working and am learning so much on how to do this. Thank you all but especially both of you for your willingness to help me learn!

 

 

Similar Threads

  1. javascript based navigation trouble
    By PomND in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 14 Aug 2011, 01:44 PM
  2. Newsletter help / Some javascript
    By visua in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 20 May 2009, 05:16 PM
  3. Adding some javascript code
    By sjohnstone in forum General Questions
    Replies: 3
    Last Post: 26 Mar 2009, 04:36 AM
  4. Where to add some javascript code?
    By snowy2007 in forum General Questions
    Replies: 11
    Last Post: 22 Feb 2009, 03:31 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