|
| |
|
|
d00nson
Posts: 142 From: Australia Status: offline
|
Setting value of a textbox based on another - 1/1/2002 11:16:07
Hi guys..can this be done? Say I have a DRW generated dropbox list with values from a database. The dropbox is called "City_list" for arguments sake. In the same form I have a textbox "City" with the initial value set to nothing. This is so I can type in any value I want. But say I wanted to insert one of the values into "City" from "City_list" by choosing it from the dropbox? TIA!! and Happy New Year!
|
|
|
|
d00nson
Posts: 142 From: Australia Status: offline
|
RE: Setting value of a textbox based on another - 1/1/2002 22:30:26
Thanks Spooky. Is it because VBScript doesn't support server side?
|
|
|
|
Spooky
Posts: 26599 Joined: 11/11/1998 From: Middle Earth Status: offline
|
RE: Setting value of a textbox based on another - 1/1/2002 23:41:26
VB does client side, but not fully supported. JS does clientside very nicely. Using serverside VB, means you need to "submit" the value so it shows when the page is reloaded. Client side, you dont. §þððk¥ Database / DRW Q & A VP-ASP Shopping cart Spooky Login
|
|
|
|
d00nson
Posts: 142 From: Australia Status: offline
|
RE: Setting value of a textbox based on another - 1/2/2002 1:05:45
Hi Spooky! Thanks for the link I'm having some trouble implementing with Javascript. Shen I select from the dropbox, the textbox referenced in the javascript doesn't work. Code follows. <form METHOD="POST" action="--WEBBOT-SELF--" name="addnewprod"> ...FP save to database wizard stuff... <table BORDER="0"> ...other plain textbox fields... <SCRIPT LANGUAGE="JavaScript"><!-- function updatebanking() { document.addnewprod.banking.value = document.addnewprod.banking_opt.options[document.addnewprod.banking_opt.selectedIndex].value } //--></SCRIPT> <tr> <td><b>banking:</b></td> <td><input NAME="banking" SIZE="40"></td> <td><select size="1" name="banking_opt" onChange="updatebanking()"> <option>1 of 1</option> <option>2 of 1</option> <option>3 of 1</option> <option>4 of 1</option> <option>2 of 2</option> <option>4 of 2</option> </select>Choose here or type your own.</td> </tr> ...more textbox fields... <td COLSPAN="3"><input TYPE="Submit" NAME="fp_submit"><input TYPE="Reset" NAME="fp_reset"></td> </tr> </table> </form>
|
|
|
|
ginnie
Posts: 527 From: St. Louis MO USA Status: offline
|
RE: Setting value of a textbox based on another - 1/2/2002 8:13:46
This should do it for you: <SCRIPT LANGUAGE="JavaScript"> <!-- function updatebanking() { var i = document.addnewprod.banking_opt.selectedIndex; var strBanking = document.addnewprod.banking_opt.options.text; document.addnewprod.banking.value = strBanking; } //--> </SCRIPT> ginnie Global Presence Web Design
|
|
|
|
d00nson
Posts: 142 From: Australia Status: offline
|
RE: Setting value of a textbox based on another - 1/4/2002 1:32:21
Thanks Ginnie! Works a treat. But what if the dropbox didn't have static values but was pulled from a database using DRW? Can you have a DRW embedded in another one?
|
|
|
|
arnie
Posts: 209 From: Gobbler Knob, Indiana Status: offline
|
RE: Setting value of a textbox based on another - 1/4/2002 10:30:25
Maybe I'm misunderstanding the need, but look at: http://www.sitebuilder.ws/frontpage/tutorials/update.htm. Especially look down the page to the <%Request... part. Build a drop-down from the database with DRW, insert the request string into the form field properties as the initial value, and then make the drop-down post where you wish for it to post. Good luck. Arnie Howes
|
|
|
|
ginnie
Posts: 527 From: St. Louis MO USA Status: offline
|
RE: Setting value of a textbox based on another - 1/4/2002 12:48:55
quote: But what if the dropbox didn't have static values but was pulled from a database using DRW?
That shouldn't make any difference. The function is performed after the form is populated by the DRW and when the dropdown menu is changed. quote: Can you have a DRW embedded in another one?
Not sure about that one ... haven't really used the DRW. Anyone else know? ginnie Global Presence Web Design
|
|
|
|
untangled2002
Posts: 6 Joined: 5/16/2002 From: Status: offline
|
RE: Setting value of a textbox based on another - 5/16/2002 13:41:08
I am tearing my hair out trying to achieve this. I can't get javascript to work when you use database results as the drop down and then try to copy them automatically into a text box field any held would be appreciated. William
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|