This topic is locked

Insert Text From DropDown Into A Text Field...

7/17/2009 11:15:21 PM
PHPRunner General questions
C
chaintm author

For the life of me I can't remember the jscript for this, but basicly I am trying to take a dropdown with a list of text on it that is done dynamically and insert any that is selected on that list into a nearby text field like the one I am typing in now.
Baiscly we have seen this everywhere, you have a drop down and you select a line in it and it autofills the main text box and if you do it again it just keeps repeating whatever text in that list you pick. Any help would be appreicated.

C
chaintm author 7/18/2009

for those looking for simular, I figured it out...
add the javascript function...
function move()

{

var no=document.getElementById("value_YOURFIELDVALUELISTHERE");

var option=no.options[no.selectedIndex].text;

var txt=document.getElementById("value_YOURTEXTFIELDBOXHERE").value;

txt=txt + option;

document.getElementById("value_YOURTEXTFIELDBOXHERE").value=txt;

}
Then in your actual code xml , add the following by the field related above usually before your listing field..
<INPUT onclick=move() type=button value="<---">
Pretty simple like I said, I just had a brain fart. This system allows you to use a pull down box dynamically listed from your database and insert the selected text pulldown by selecting the pulldown selection then hitting the value button.
Hope this comes in handy for others, I know I need it allot, but eh again brainfart <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=42813&image=1&table=forumreplies' class='bbc_emoticon' alt=':P' />