dynamic drop down menu based on xml data

D

Dan Thomas

I'm new to ruby, html and javascript (ouch). In an erb file I am
reading a value from an xml. Then I need to display a drop down menu
where THAT one is selected. For now I am just hard coding all the
possible selections in html.

So for example see below, "animation_asset" may come back as being equal
to "Animation 2", in which case the html selection component would like
like below.

But how do I do this dynamically? What if it comes back as "Animation
1".

I'm thinking I may need some javascript. I have called hello-world
javascript through buttons, so I have some javascript functions in my
html doc already. I'm just not sure what to call and what to return.
Thanks.

<%animation_asset = pathElementsArray[assetPos] # say it is equal to
"Animation 2"%>

<select name = "somename" value="">
<option > Animation 1</option>
<option selected="yes">Animation 2</option>
<option>Animation 3</option>
</select>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top