SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
-
Jan 12, 2007, 11:52 #1
- 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!
-
Jan 12, 2007, 18:50 #2
- 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?
-
Jan 12, 2007, 21:41 #3
- 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.
-
Jan 12, 2007, 21:47 #4
- 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.
-
Jan 12, 2007, 23:20 #5
- 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?
-
Jan 13, 2007, 00:50 #6
- 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()});
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>
Bookmarks