SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 35

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Category Select does not complete - On Click

    Hello

    Could someone help me solve the problem on the Sell and Wanted Ads pages.

    http://numberthree.netne.net/index.php

    On the Sell & Wanted Ads pages, you need to Select a Category. eg: Art - Modern

    the Category Select does not complete, no On Click,

    you will need to Register to access the Sell & Wanted Ads pages.

    or PM me and I will send you a Log In Username & Password

    all help and ideas greatly appreciated

  2. #2
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    i would help your cause to set up a user account that we could access the page with !! Or disable the protection until you resolve the issue.
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  3. #3
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Mandes

    thank you for your offer of help

    I have sent you a PM with the Username & Password


  4. #4
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    OK had a look, but the code isnt viewable from HTML, you'll need to post the Javascript that populates the 2nd layer
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  5. #5
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Mandes, thank you for taking a look,

    Java script 2nd layer ? I am new to this website/script world, yet learning

    please tell me where I should look for Java script 2nd layer ? in a php file ?

    if you want copies of the php files emailed to you, or posted here on the forum please just tell me.


  6. #6
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    Javascript files are client-side, Mandes, you should be able to see their contents (because the browser has to be able to). I assume you meant to say we need to see the AJAX-receiver PHP code. (this of course is a blind observation)
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  7. #7
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Starlion


    yep but the code for the second level of dropboxes doesnt appear when I do a source view

    heres the screen shot and the code that is given by a source view of the same page
    Attached Images Attached Images
    Attached Files Attached Files
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  8. #8
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure what you're referring to... i've been given a login, but the javascript seems to work fine for me...

    http://picpaste.com/pics/cats-el2PQ09W.1330003325.jpg
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  9. #9
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello StarLion

    I am referring to the Category Select, in your screen pic the word -none- should be replaced by the Category: Antiques & Art - Architectural - Garden

    but that does not happen, the On Click does not load the Category,

    your help appreciated

  10. #10
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    Ahhhh okay. I see now.

    So the function the box calls is an AJAX caller...
    Code:
    function select_category(category_id, box_id, prefix, reverse, click_select, listing_type, list_in)
    {
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
    alert ("Browser does not support HTTP Request");
    return;
    }
    var url = relative_path + 'ajax_files/select_category.php';
    var action = url + '?category_id=' + category_id + '&target_box_id=' + box_id +
    '&prefix=' + prefix + '&reverse_categories=' + reverse + '&click_select=' + click_select +
    '&listing_type=' + listing_type + '&list_in=' + list_in;
    // xmlHttp.onreadystatechange = function() { showResult(xmlHttp, box_id); };
    xmlHttp.onreadystatechange = function() {
    if (xmlHttp.readyState == 4)
    {
    var response = xmlHttp.responseText;
    //document.getElementById(box_id).innerHTML = response;
    if (response.indexOf('change_category') == 0 && click_select != true)
    {
    eval(response);
    }
    else
    {
    document.getElementById(box_id).innerHTML = response;
    }
    }
    };
    xmlHttp.open("GET", action, true);
    xmlHttp.send(null);
    }
    The onchange (not onclick, btw) code handler is:
    Code:
    select_category(this.value, 'main_category_field', 'main_', 0, false, 'auction', 'auction')
    so i tracked this.value...
    clicking on the "Select" link returned null for this.value.
    clicking on Antiques and Art gave it value 215
    clicking on Antiquities gave it value 225.

    So now your query string to your page reads:
    "ajax_files/select_category.php?category_id=225&target_box_id=addl_category_field&prefix=addl_&reverse_categories=0&click_select=false&listing_type=auction&list_in=auction"

    This returns:
    change_category(225, 'addl_', 0); (or does it?)
    which should fire eval(change_category(225, 'addl_', 0);

    Except... it doesnt. And why does it not?
    http://numberthree.netne.net/ajax_fi...ist_in=auction

    View Source on that page. You see the extra stuff your host is packing onto the response? Guess what. Javascript tries to run that through eval, and it borks.

    What is ACTUALLY going into eval, is: "change_category(225, 'main_', 0);\r\n<!-- www.000webhost.com Analytics Code -->\r\n<script type=\"text/javascript\" src=\"http://analytics.hosting24.com/count.php\"></script>\r\n<noscript><a href=\"http://www.hosting24.com/\"><img src=\"http://analytics.hosting24.com/count.php\" alt=\"web hosting\" /></a></noscript>\r\n<!-- End Of Analytics Code -->\r\n"

    Slice off the extra stuff, and it works fine.
    PS: Did all this in Firebug. Very handy tool.
    PPS: Could have just had the PHP code return the parameters part and straight-called change_category passing it the parameters. Safer than eval.
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  11. #11
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow StarLion ! that was fast!

    ok I just read your post 3-4 times, and understood about 60% (new to this)

    so what do I do to make it work? what php? remove/slice off what? where?

    details for for a learner much appreciated

    PS: and it this caused by my Server? or the script ?

  12. #12
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    Without seeing the code for ajax_files/select_category.php, i cant say whether it was the server or the script. I'm -guessing- it was the server, though.

    How to fix:
    Where you have:
    Code:
    var response = xmlHttp.responseText;
    inside the select_category function (inside the jquery/global.js file), try...
    Code:
    var response = xmlHttp.responseText;
    response = response.substring(0,response.indexOf(";")) + ";";
    instead.

    This -should- trim down the string to the needed component.

    EDIT: Decided i didnt like playing around with index addition.
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  13. #13
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello StarLion.

    ok went to jquery folder, opened global.js file, added code, saved, went to the Sell page on the website, no change/improvement.

    function showResult(xmlHttp, id)
    {
    if (xmlHttp.readyState == 4)
    {
    var response = xmlHttp.responseText;
    response = response.substring(0,response.indexOf(";")) + ";";
    id.innerHTML = unescape(response);
    }
    }

  14. #14
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by StarLion View Post
    inside the select_category function (inside the jquery/global.js file), try...
    Quote Originally Posted by RayWilk View Post
    function showResult(xmlHttp, id)
    {
    if (xmlHttp.readyState == 4)
    {
    var response = xmlHttp.responseText;
    response = response.substring(0,response.indexOf(";")) + ";";
    id.innerHTML = unescape(response);
    }
    }
    Wrong function
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  15. #15
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    function select_category(category_id, box_id, prefix, reverse, click_select, listing_type, list_in)
    {
    xmlHttp=GetXmlHttpObject();

    if (xmlHttp==null)
    {
    alert ("Browser does not support HTTP Request");
    return;
    }

    var url = relative_path + 'ajax_files/select_category.php';
    var action = url + '?category_id=' + category_id + '&target_box_id=' + box_id +
    '&prefix=' + prefix + '&reverse_categories=' + reverse + '&click_select=' + click_select +
    '&listing_type=' + listing_type + '&list_in=' + list_in;

    // xmlHttp.onreadystatechange = function() { showResult(xmlHttp, box_id); };
    xmlHttp.onreadystatechange = function() {
    if (xmlHttp.readyState == 4)
    {
    var response = xmlHttp.responseText;
    response = response.substring(0,response.indexOf(";")) + ";";
    //document.getElementById(box_id).innerHTML = response;
    if (response.indexOf('change_category') == 0 && click_select != true)
    {
    eval(response);
    }
    else


    .....................................................

    ok done correctly I hope this time...lol

    yet still no change in Category loading behavior.

  16. #16
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    Ok. It did change things, but broke the regular behavior instead. Woops.

    Move that response = response.substring(0,response.indexOf(";")) + ";"; line INSIDE the if (IE: right before the eval line). Save, upload, hold down shift, and push F5.
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  17. #17
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi StarLion

    could you please show how the text will look,

    var response = xmlHttp.responseText;
    response = response.substring(0,response.indexOf(";")) + ";";
    //document.getElementById(box_id).innerHTML = response;
    if (response.indexOf('change_category') == 0 && click_select != true)
    {
    eval(response);
    }
    else

    I have my Servers File Manager open and am changing the files within my public.html/jquery/global.js , then saving, then reloading my Sell page to test.

    ok?

  18. #18
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    Code:
    var response = xmlHttp.responseText;
    response = response.substring(0,response.indexOf(";")) + ";";
    //document.getElementById(box_id).innerHTML = response;
    if (response.indexOf('change_category') == 0 && click_select != true)
    {
    eval(response);
    }
    =>
    Code:
    var response = xmlHttp.responseText;
    //document.getElementById(box_id).innerHTML = response;
    if (response.indexOf('change_category') == 0 && click_select != true)
    {
    response = response.substring(0,response.indexOf(";")) + ";";
    eval(response);
    }
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  19. #19
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi StarLion

    Success

    the Category Select is working perfectly! many many thank you's

    so I created 2 Wanted Ads, uploaded a photo to both, yet when I go to Wanted Ads Page it says/shows - No Image Available

    could you please have a look into why - No Image is showing,

    your help greatly appreciated

    RayWilk

  20. #20
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    Where is said image supposed to appear?
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  21. #21
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello StarLion

    on the Sell & Wanted Ads pages is the upload a photo option to display a photo with the Ad,

    I have created a Sell and Wanted Ad, yet no photos showing, only the "No Image Available"

    I looked in: /public_html /uplimg and yes the photos/images have been uploaded to the server

    if you look at the Home page http://numberthree.netne.net/index.php you will see the "No Image Available"

    your help appreciated


  22. #22
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello BavanaghCndra,

    how do find the Javascript that populates the 2nd layer

    point me in the right direction please


  23. #23
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    Without seeing the PHP code for that page, I cant tell where the image is supposed to be being pulled from. It's obviously been uploaded, but it either A: wasnt written to the database, or B: is failing some check on loading.
    Off Topic:

    I dont check this forum on weekends.
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  24. #24
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi StarLion

    good to hear from you

    ok please tell me how to check A & B?

    A: wasn't written to the database: where do I look in the database? search for?

    PS: a rest from the Forum in the weekend is a great idea

  25. #25
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    A: Without seeing the PHP code, I cant really tell you any more other than to trace backwards the variable used for the picture - eventually you'll get to a SQL query. That query will tell you which table to check. (It's PROBABLY called something obvious, like adverts or something.)
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.


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
  •