Having this form with this drop down menu:
<form id="form1" name="form1" method="post" action="">
<select name="myList" id="myList">
<option value="1">item1</option>
<option value="2">item2</option>
<option value="3">item3</option>
<option value="4">item4</option>
</select>
<input type="button" name="test" id="test" value="test"
onClick="alertSelected();">
</form>
If I wanted the value of the selected item, using Prototype, I'd have:
function alertSelected ()
{
alert ( $F('myList') );
}
What If I want the text?
This works, but it looks like a lot of work.
function alertSelected ()
{
alert ( document.form1.myList[$F('myList')].text);
}
Can't this be simplified, taking advantage of Prototype?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---