Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Placing the selection of a list field in a text field

Reply
Thread Tools

Placing the selection of a list field in a text field

 
 
Jerry Manner
Guest
Posts: n/a
 
      06-07-2005
Hi

I have a field with a list of items. Like below:
<select width="100" size="1" name="Industrielijst" style="font-family:
Arial; font-size: 8pt">
<option value="P1">Plants</option>
<option value="P2">Software</option>
<option value="P3">Hardware</option>
<option value="P4">System</option>
<option value="P5">Screens</option>
</select>

Above this field I have a text field, like this.
<input type="text" name="T1" size="40">

Is it possible when I make a selection to place that selection in the
text field automatically? If so , how can I do that with javascript?

Regards

 
Reply With Quote
 
 
 
 
Hywel Jenkins
Guest
Posts: n/a
 
      06-07-2005
In article <(E-Mail Removed). com>,
http://www.velocityreviews.com/forums/(E-Mail Removed) says...
> Hi
>
> I have a field with a list of items. Like below:
> <select width="100" size="1" name="Industrielijst" style="font-family:
> Arial; font-size: 8pt">
> <option value="P1">Plants</option>
> <option value="P2">Software</option>
> <option value="P3">Hardware</option>
> <option value="P4">System</option>
> <option value="P5">Screens</option>
> </select>
>
> Above this field I have a text field, like this.
> <input type="text" name="T1" size="40">
>
> Is it possible when I make a selection to place that selection in the
> text field automatically? If so , how can I do that with javascript?
>
> Regards


Untested:
<select onchange="T1.value = this[this.selectedIndex].value;" ...

--
Hywel

Kill the Crazy Frog
http://www.petitiononline.com/crzyfrg/
 
Reply With Quote
 
 
 
 
Jerry Manner
Guest
Posts: n/a
 
      06-08-2005
Hi

I did what you said, but the text field shows the text "undefined" when
I make a selection from the list. What must I change in the onchange
code?


Regards

 
Reply With Quote
 
Jerry Manner
Guest
Posts: n/a
 
      06-08-2005
Maybe I should mention this. The select part of the code is inside a
<div> tag.

 
Reply With Quote
 
Mark Parnell
Guest
Posts: n/a
 
      06-08-2005
Previously in alt.html, Jerry Manner <(E-Mail Removed)> said:

> Hi


G'day.

> I did what you said,


I didn't say anything.

> but the text field shows the text "undefined" when
> I make a selection from the list. What must I change in the onchange
> code?


Impossible to say without a URL.

--
Mark Parnell
http://www.clarkecomputers.com.au
alt.html FAQ :: http://html-faq.com/
 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      06-09-2005
Hywel Jenkins wrote:
> In article <(E-Mail Removed). com>,
> (E-Mail Removed) says...
>
>>Hi
>>
>>I have a field with a list of items. Like below:
>><select width="100" size="1" name="Industrielijst" style="font-family:
>>Arial; font-size: 8pt">
>><option value="P1">Plants</option>
>><option value="P2">Software</option>
>><option value="P3">Hardware</option>
>><option value="P4">System</option>
>><option value="P5">Screens</option>
>></select>
>>
>>Above this field I have a text field, like this.
>><input type="text" name="T1" size="40">
>>
>>Is it possible when I make a selection to place that selection in the
>>text field automatically? If so , how can I do that with javascript?
>>
>>Regards

>
>
> Untested:
> <select onchange="T1.value = this[this.selectedIndex].value;" ...
>

Couple things here..

1. Wrap the form elements in a form, else grabing T1 becomes very difficult
2. This DOES require Javascript to be ENABLED to work
3. The code:

<form>
<select width="100" size="1" name="Industrielijst" style="font-family:
Arial; font-size: 8pt"
onchange="this.form.T1.value=this.options[selectedIndex].value">
<option value="P1">Plants</option>
<option value="P2">Software</option>
<option value="P3">Hardware</option>
<option value="P4">System</option>
<option value="P5">Screens</option>
</select>
<input type="text" name="T1" size="40">
</form>

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Placing an "icon" in the address field for the browser Ray Stevens ASP .Net 4 04-26-2005 03:42 PM
update text field based on selection field pkinville@hotmail.com Javascript 13 01-28-2005 05:09 PM
JS comparing innerHTML to text selection (window.getSelection() /document.selection) Andrew Crowe HTML 1 09-13-2004 02:22 PM
How to change a range selection to text selection? Loebb Javascript 0 02-23-2004 02:12 PM
HOWTO autopost the selection list upon selection curiousity ASP .Net Mobile 0 11-21-2003 12:57 AM



Advertisments