PDA

View Full Version : change input name and value with dropdown list



awatts1984
10-16-2009, 04:13 PM
I'm a n00b so please forgive me if this is a stupid question or if the info is listed somewhere else. I really did try and find it on my own.

I'm trying to make a form that searches my amazon astore. I found this html search box code for:

<form action="http://astore.amazon.com/adbabel-20/search" method="get" target="_blank">
<input name="node" value="8" type="hidden">
<input name="keywords" size="12" value="" type="text">
<button type="submit" >Search</button>
</form>

this results in the form submitting http://astore.amazon.com/adbabel-20/search?node=8&keywords=keyword

it works well but is limited to searching only one category in my store (i have several). each category is assigned a node value (in this case 8). By changing the node value in the code I can change which category in my astore that is searched.

I want to create a drop down list that lists all of my catagories and changes the node value upon selection. Can anyone let me know how this might be done with dhtml or javascript (or html if it can be done that way)

Thanks a million!

here's a link to the code i posted about in action: http://www.adbabel.net/astore-search/script-html.html

prasanthmj
10-17-2009, 02:24 AM
Update the code this way (by adding a select box)



<form action="http://astore.amazon.com/adbabel-20/search" method="get" target="_blank">
<select name="node" size='1'>
<option value='1'>Category 1</option>
<option value='2'>Category 2</option>
<option value='3'>Category 3</option>
<option value='8'>Category 8</option>
</select>
<input name="keywords" size="12" value="" type="text">
<button type="submit" >Search</button>
</form>


More info:
HTML form input examples (http://www.html-form-guide.com/html-form/html-form-input.html)

HTML Form Tutorial (http://www.javascript-coder.com/html-form/html-form-tutorial-p1.phtml)