Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Text Box Value

Status
Not open for further replies.

caper1175

MIS
Sep 23, 2003
42
US
HI all: I have a page called index.asp with a drop-list box being used to navigate to other pages. Also on this page is a text box called BTN. So when a user makes a selection from the drop-list box and presses GO, I want to pass the value in the BTN text box to the page that was selected and populate the BTN text box on that page. Here is the code for my drop-list box if it helps.

Code:
<form method="POST" name="SendMe"> 
    <p><select name="DropIt" size="1"> 
        <option></option> 
        <option> Save </option> 
        <option> Undecided </option> 
        <option> Cancel </option> 
	 <option> Ineligible </option>
    </select> <input type="button" name="B1" value="Go"> 
     <SCRIPT FOR="B1" EVENT="onClick" LANGUAGE="VBScript"> 
     select case document.sendme.dropit.selectedindex 
          case 0 
            navigate("index.asp") 
          case 1 
            navigate("save.asp") 
          case 2 
            navigate("undecided.asp") 
          case 3 
            navigate("cancel.asp") 
          case 4
          	navigate("ineligible.asp")
     end select 
     </SCRIPT> 
   </form>
 
I understand why you post a client-side script to asp forum! Nonetheless, a couple of notes are in order.

[1] You text box as an input control, should it not be contained in the form, one form or another! Let's say in the form "SendMe".
[tt]
<form method="POST" name="SendMe">
<!-- somewhere -->
<input type="text" name="BTN" value="xxx" />
<!-- etc etc -->
</form>
[/tt]
[2] You use navigate which take out most functionality of the form proper. But, if so desired, it is fine! To pass the value of the text box value to the next page, change the url like this. Take the index 1 for instance.
[tt]
case 1
navigate("save.asp" & "?BTN=" & escape(document.SendMe.BTN.value))
[/tt]
Exact similarity is for other cases. I use escape() just for simplicity---in most cases it would urlencode the BTN's value close enough to be properly urlencode. The idea is there. The action page should then pick up the BTN value accordingly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top