Log in

View Full Version : Resolved Passing variable in dropdown menu to a button



brent.fraser
08-19-2009, 01:40 PM
Hi all,

I am currently working on a web-page that parses an XML file and puts it into HTML. What I have are three sorting buttons to sort the rows to list them alphabetically etc. The code for the buttons is below and it is working perfectly fine.


<INPUT TYPE=BUTTON VALUE="Sort By Name" onclick="sort(sortName.XMLDocument);">
<INPUT TYPE=BUTTON VALUE="Sort By Patient ID" onclick="sort(sortNumber.XMLDocument);">
<INPUT TYPE=BUTTON VALUE="Get Names A through M" onclick="sort(getAtoM.XMLDocument);">
What I want to do though is take away the buttons and make them a dropdown list and a go button. I have tried the following code and it doesn't work.


<form name="docSortList">
<select name="sort">
<option value="sort(sortName.XMLDocument);">Sort By Name</option>
<option value="sort(sortNumber.XMLDocument);">Sort By Patient ID</option>
<option value="sort(getAtoM.XMLDocument);">Get Names A through M</option>
</select>
<input type="button" onClick="location=document.docSortList.sort.options[document.docSortList.sort.selectedIndex].value;" value="GO">
</form>

When I click on the go button, it opens up a blank page.

I have a feeling it has something to do with the "location=document......." since I am not wanting it to go to a location, i want it to carry out an action.

Still working on it but any guidance would be greatly appreciated.

Thanks.
B