Dynamically populate a field based on dropdown selection (Javascript / HTML) -


Good morning all!

I am looking for some help in coding the websites of my companies. We are trying to create a custom "part number generator" based on the selections made from a dropdown box. Our goal is that when a user chooses an option in the dropdown box which dynamically fills it in a box below, Finally creates a fraction number. The attached screenshot is a good visual representation of the design and where we want the output box. We are trying to do it in javascript and html.

We are currently using this code to get just one box which generates output based on selection:

   

  & lt; Form id = "example" name = "example" & gt; & Lt; Select ID = "Selector" name = "Selector" & gt; & Lt; Option value = "" selected & gt; & Lt; / Option & gt; & Lt; Option value = 1> A & lt; / Options & gt; & Lt; Option value = 2> Two & lt; / Options & gt; & Lt; / Select & gt; & Lt; Br / & gt; & Lt; Input type = "text" value = "" id = "populateme" name = "populateme" /> & Lt; / Form & gt; & Lt; Script type = "text / javascript" & gt; Document.example.selector.onchange = updateText; Function Update Text () {var obj_sel = document.example.selector; Document.example.populateme.value = myData [obj_sel.value]; } & Lt; / Script & gt;  

I have searched this website a little and have found some solutions for dynamic area populations, but when I try to add another form or move that box In which it will output, the code just stops working. I was thinking that someone has experience with popularizing many areas with a dropdown selection. Can I donate, just message me or comment below. I appreciate any and all help.


Information about the picture: This photo is being done with our current Joomla form extension and Photoshop, which we all like to see. I do not care about gray boxes or formatting, we have problems with code to move the output box down (horizontal queued) and options are vertical.

The easiest solution (without array):

< Pre> & lt; Html & gt; & Lt; Body & gt; & Lt; Form id = "example" name = "example" & gt; & Lt; Select ID = "sensor" onchange = "updateText ('sensor')" & gt; & Lt; Option value = "J" & gt; J & LT; / Options & gt; & Lt; Option value = "K" & gt; K & lt; / Options & gt; & Lt; / Select & gt; & Lt; Id = "voltage" onchange = "updateText ('voltage')" & gt; & Lt; Option value = "120V" & gt; 120V & lt; / Options & gt; & Lt; Option value = "240V" & gt; 240V & lt; / Options & gt; & Lt; / Select & gt; & Lt; Br / & gt; & Lt; Input type = "text" value = "" id = "sensor text" /> & Lt; Input type = "text" value = "" id = "voltage text" /> & Lt; / Form & gt; & Lt; Script type = "text / javascript" & gt; Function update text (type) {var id = type + 'text'; Document.getElementById (id) .value = document.getElementById (type). Value; } & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt;

You can also make a lot complicated using the hash array. I know that you need a complex solution.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -