Jump to content


Photo

dropdown jump menu.. need help!!


  • Please log in to reply
5 replies to this topic

#1 dharm

dharm
  • Members
  • PipPip
  • Member
  • 27 posts

Posted 05 October 2006 - 07:42 PM

Hi. I was wondering if anyone could help me with this jump menu.. The jump menu is part of a form that includes other fields which make up a search page. The jump menu works fine but the problem is with the other input text fields.. if for example when I input data in any of the other fields then select a option from the jump menu the page will refresh but the data from the text fields I entered will not appear..

Is there a way where I can save the data from the forms when the jump menu re-loads the page?.. Or is there a better alternative then using an old fashion jump menu ..? 

Here is the code:

<select name="category" onChange="window.location = this.options[this.selectedIndex].value">
<option value="search.php">Any</option>
<option value="search.php?cats=1">1</option>
<option value="search.php?cats=2">2</option>
</select>


Any help will be much appreciated… 


#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 05 October 2006 - 08:54 PM

Cookies come to mind....
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 05 October 2006 - 11:25 PM

yes don't use the jump menu - make the user hit a submit button.
follow me on twitter @PHPsycho

#4 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 06 October 2006 - 05:41 AM

Try this:
<select name="category" onChange="location.href=this.value">
<option value="search.php">Any</option>
<option value="search.php?cats=1">1</option>
<option value="search.php?cats=2">2</option>
</select>


#5 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 06 October 2006 - 01:18 PM

Just remember that any JS-only solution is limiting... if this is real functionality, use a submit button, as mentioned earlier.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#6 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 06 October 2006 - 02:33 PM

In this case I would actually use this:
<form method='get'>
<select name="cats" onChange="form.submit()"> <!-- not sure about this. I can't remember how to submit forms using javascript -->
<option value="">Any</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<button type='submit'>Go</button>
</form>

This would work without javascript.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users