SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Feb 2001
    Location
    -
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    GreyBox - Javascript submitting problem

    Can anybody look at http://www.wusource.com/books/test/ and tell me why my submission links don't work for the greybox? Type something in the text box, and click "regular link" - you'll see that works fine. If you click the popin link, (same javascript location href as the first link), the greybox opens with a blank page. I thought it had to do with the apostrophes being passed on, so I escaped them by typing \' in the links which allows the page to be loaded in the greybox (but then the variables aren't passed on).

    Is there a better way to do this submitting with a link, so that everything will be passed properly to the greybox? I'm using code from GreyBox at http://orangoo.com/labs/GreyBox/ .

    Thanks in advance!

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    It seems like it's not working because, as the javascript console indicates, document.f has no properties. Have you got a variable called that you haven't declared properly?

  3. #3
    SitePoint Addict
    Join Date
    Feb 2001
    Location
    -
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "document.f.q.value" should pull the value of field "q" in form "f". If you click on the first link, you'll notice that javascript properly fills that field in the query string, as well as document.f.SortBy.value . I don't think that's the issue with this, but I still can't figure anything else out.

  4. #4
    Employed Again Viflux's Avatar
    Join Date
    May 2003
    Location
    London, On.
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:

    When I read "Greybox", I thought there was some other unfortunate soul who had to deal with that POS software. Now I will return to wallowing in my misery.

  5. #5
    SitePoint Addict
    Join Date
    Feb 2001
    Location
    -
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any suggestions for another script that works similar to Greybox?

  6. #6
    SitePoint Addict Mirek Komárek's Avatar
    Join Date
    Dec 2006
    Location
    Prague
    Posts
    210
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try add function to head

    Code:
    function setURL(){
    var var1=document.getElementById('q').value;
    var var2=document.getElementById('SortBy').options[document.getElementById('SortBy').selectedIndex].value;
    var searchurl='http://www.wusource.com/books/textbooks.php?Search='+var1+'&Mode=books&SortBy='+var2;
    var changeLink=document.getElementById('lnk')
    changeLink.removeAttribute('href');
    changeLink.setAttribute('href',searchurl);
    }
    function SetHref(){
    document.getElementById('q').onkeyup=function(){setURL()}
    document.getElementById('SortBy').onchange=function(){setURL()}
    }
    AJS.AEV(window,"load",SetHref);
    //AJS.AEV(window, 'load', function() {SetHref()});
    And add id to html
    Code:
    <form method="get" action="http://www.wusource.com/books/textbooks.php" name="f">
    Search for <input name="q" id="q" value="" type="text">
      <input name="Mode" value="books" type="hidden">
    
              sorted by<strong>
              <select id="SortBy" style="visibility: visible;" name="SortBy">
                <option value="+pmrank">Featured Items</option>
                <option value="+salesrank" selected="selected">Bestselling</option>
                <option value="+reviewrank">Average Customer Review</option>
                <option value="+pricerank">Price (Low to High)</option>
                <option value="+inverse-pricerank">Price (High to Low)</option>
                <option value="+daterank">Publication Date</option>
                <option value="+titlerank">Alphabetical (A-Z)</option>
                <option value="-titlerank">Alphabetical (Z-A)</option>
              </select>
              </strong> 
    <br>
    <a id="lnk" href="http://www.wusource.com/books/textbooks.php" rel="gb_pageset[search_sites]">popin link</a><br>
    </form>
    And upload it there, I will check it again.


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
  •