Hi Colin,
Your "check the HTML" tip is *great* ... it's now in my debugging
arsenal.
> comma missing
That was a tip on my img-base code. I'll get back to that because I
like the down-arrow image better that ShowList button version, which
is close to working.
My last next-to-last problem in this code is that the ShowList button
doesn't toggle the visibility of the vendor_droplist. My guess is
that the onclick value is RJS that should have been translated into
JavaScript at this point.
My final problem is how to add on-click code to the return vendor
items so that clicking any of them toggles (or hides: same effect in
this context) the vendor_droplist. But I can probably do this on my
own correctly.
Below is the ERB code and the generated HTML for the vendor input. As
I've done so often, thank you for looking into my problem. I am
learning this stuff steadily so I should post questions much less
frequently in just a few weeks.
Best wishes,
Richard
Vendor input code
=============
<p>
<%= f.label :vendor %><br />
<%= f.text_field :vendor %>
<%= button_to_function("ShowList",
%<page[:vendor_droplist].toggle> ) %>
<br>
<div id="vendor_droplist", style="display:none">
<%= select_tag "test",
options_for_select(@current_vendors.collect { |v|
v.nickname }),
{:multiple => true} %>
</div>
</p>
Generated HTML
============
<p>
<label for="expense_vendor">Vendor</label><br />
<input id="expense_vendor" name="expense[vendor]" size="30"
type="text" />
<input onclick="page[:vendor_droplist].toggle;" type="button"
value="ShowList" />
<br>
<div id="vendor_droplist", style="display:none">
<select id="test" multiple="multiple" name="test[]"><option
value="IBM">IBM</option>
<option value="Fed Ex">Fed Ex</option></select>
</div>
</p>
On Mar 21, 5:04 am, Colin Law <clan...@googlemail.com> wrote:
> On 21 March 2010 04:07, RichardOnRails
>
> <RichardDummyMailbox58...@uscomputergurus.com> wrote:
> > Hi,
>
> > I've got the following code in my attempt to provide the subject
> > functionality, lines 20-29 in view:
>
> > <%= image_tag "DownArrow.jpg" options =
> > { onclick=page["vendor_droplist"].show } %>
>
> I don't know whether it is still relevant after your later emails but
> the problem here is (at least in part) that you are missing a comma
> after "DownArrow.jpg" and a > after options =
>
> Colin
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment