Solved my own problem and thought I would share it here for those who
may run into the same problem as I.
When you need to apply a method (such as the selectedIndex and value
setting I tried) across multiple elements, you have to use the
invoke() method. in my case I had to use the following statements:
First, I decided that I needed to clear the options from my other
select boxes instead of just selecting the top one, so I used...
$("selectTwo","selectThree","selectFour").invoke("update","<option
value='0'>none</option>");
Form my text/hidden fields, I used this...
$("warrantyAmount","hWarrantyType","hWarrantyCost").invoke("setValue",
"0.00");
Which BTW uses the undocumented setValue() method. I was about to add
this method myself when I found that it already existed! Why such an
important and useful method is not in the documentation I will never
know.
On Jan 17, 9:52 am, KilLrBuNieZ <[EMAIL PROTECTED]> wrote:
> I have a form with four select boxes with cascading dependency, i.e.
> when you make a selection on #1 it populates #2 with options. A
> selection in #2 populates #3, etc. This eventually leads to a dollar
> amount being calculated.
>
> My problem is when the user selects the "no selection" first option in
> the #1 select box. I need to "reset" the other three select boxes.
> However, the following throws no errors but does not work:
>
> $("selectTwo","selectThree","selectFour").selectedIndex = 0;
>
> The following does work, but come on!
>
> $("selectTwo").selectedIndex = 0;
> $("selectThree").selectedIndex = 0;
> $("selectFour").selectedIndex = 0;
>
> The same holds true when I try to set the value of multiple text/
> hidden fields:
> $("textTwo","textThree","textFour").value= ""; fails to do anything,
> where individual calls work fine.
>
> What should I do different to get this to work on one call like it
> should?
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---