RichardOnRails
2010-Mar-21 04:07 UTC
How to initially hide a drop-down control and have an image control make it visible
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 } %> <br> <div name="vendor_droplist"> <%= select_tag "test", options_for_select(@current_vendors.collect { |v| v.nickname }), {:multiple => true} %> </div> Until I put in the options on image tag and added the div, this code display a list of vendor nicknames. Now I have several problems: 1. Syntax error in line 20 where an identifier was encountered where a right-paren was expected (see below) 2. I don''t know how to make the vendor_droplist initially hidden I''ve Googled for "Rails Ajax toggled item" and got a number of hits but no apparent answer. I''ll keep poking around the Web, but I appreciate some suggestion(s). Thanks in advance, Richard Showing app/views/expenses/new.html.erb where line #20 raised: compile error K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/views/expenses/ new.html.erb:20: syntax error, unexpected tIDENTIFIER, expecting '')'' @output_buffer.concat " "; @output_buffer.concat(( image_tag "DownArrow.jpg" options { onclick=page["vendor_droplist"].show } ).to_s); @output_buffer.concat "\n" ^ K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/views/expenses/ new.html.erb:20: odd number list for Hash @output_buffer.concat " "; @output_buffer.concat(( image_tag "DownArrow.jpg" options { onclick=page["vendor_droplist"].show } ).to_s); @output_buffer.concat "\n" ^ Extracted source (around line #20): 17: <p> 18: <%= f.label :vendor %><br /> 19: <%= f.text_field :vendor %> 20: <%= image_tag "DownArrow.jpg" options { onclick=page["vendor_droplist"].show } %> 21: <br> 22: <div name="vendor_droplist"> 23: <%= select_tag "test", Trace of template inclusion: app/views/expenses/new.html.erb RAILS_ROOT: K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS Application Trace | Framework Trace | Full Trace K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/views/expenses/ new.html.erb:59:in `compile!'' K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/controllers/ expenses_controller.rb:30:in `new'' -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
RichardOnRails
2010-Mar-21 04:33 UTC
Re: How to initially hide a drop-down control and have an image control make it visible
I think I corrected the div by: 1. giving it an id rather than a name 2. adding display:none to start it off hidden as follows: <%# = image_tag "DownArrow.jpg" options { onclick=page["vendor_droplist"].show } %> <br> <div id="vendor_droplist", style="display:none"> <%= select_tag "test", options_for_select(@current_vendors.collect { |v| v.nickname }), {:multiple => true} %> </div> On Mar 21, 12:07 am, RichardOnRails <RichardDummyMailbox58...-FtJgd9dCuO3JTKoYRCtP1UEOCMrvLtNR@public.gmane.org> 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 } %> > <br> > <div name="vendor_droplist"> > <%= select_tag "test", > options_for_select(@current_vendors.collect { |v| > v.nickname }), > {:multiple => true} %> > </div> > > Until I put in the options on image tag and added the div, this code > display a list of vendor nicknames. Now I have several problems: > > 1. Syntax error in line 20 where an identifier was encountered where a > right-paren was expected (see below) > 2. I don''t know how to make the vendor_droplist initially hidden > > I''ve Googled for "Rails Ajax toggled item" and got a number of hits > but no apparent answer. I''ll keep poking around the Web, but I > appreciate some suggestion(s). > > Thanks in advance, > Richard > > Showing app/views/expenses/new.html.erb where line #20 raised: > > compile error > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/views/expenses/ > new.html.erb:20: syntax error, unexpected tIDENTIFIER, expecting '')'' > @output_buffer.concat " "; @output_buffer.concat(( image_tag > "DownArrow.jpg" options > { onclick=page["vendor_droplist"].show } ).to_s); > @output_buffer.concat "\n" > > ^ > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/views/expenses/ > new.html.erb:20: odd number list for Hash > @output_buffer.concat " "; @output_buffer.concat(( image_tag > "DownArrow.jpg" options > { onclick=page["vendor_droplist"].show } ).to_s); > @output_buffer.concat "\n" > > ^ > > Extracted source (around line #20): > > 17: <p> > 18: <%= f.label :vendor %><br /> > 19: <%= f.text_field :vendor %> > 20: <%= image_tag "DownArrow.jpg" options > { onclick=page["vendor_droplist"].show } %> > 21: <br> > 22: <div name="vendor_droplist"> > 23: <%= select_tag "test", > > Trace of template inclusion: app/views/expenses/new.html.erb > > RAILS_ROOT: K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS > Application Trace | Framework Trace | Full Trace > > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/views/expenses/ > new.html.erb:59:in `compile!'' > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/controllers/ > expenses_controller.rb:30:in `new''-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
RichardOnRails
2010-Mar-21 04:37 UTC
Re: How to initially hide a drop-down control and have an image control make it visible
I think I improved two things in the version of lines 20-26 below: 1. I gave the div an id rather than a name 2. I gave the div a style of "display:none" so that it''s hidden at every startup of the view <%# = image_tag "DownArrow.jpg" options { onclick=page["vendor_droplist"].show } %> <br> <div id="vendor_droplist", style="display:none"> <%= select_tag "test", options_for_select(@current_vendors.collect { |v| v.nickname }), {:multiple => true} %> </div> On Mar 21, 12:07 am, RichardOnRails <RichardDummyMailbox58...-FtJgd9dCuO3JTKoYRCtP1UEOCMrvLtNR@public.gmane.org> 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 } %> > <br> > <div name="vendor_droplist"> > <%= select_tag "test", > options_for_select(@current_vendors.collect { |v| > v.nickname }), > {:multiple => true} %> > </div> > > Until I put in the options on image tag and added the div, this code > display a list of vendor nicknames. Now I have several problems: > > 1. Syntax error in line 20 where an identifier was encountered where a > right-paren was expected (see below) > 2. I don''t know how to make the vendor_droplist initially hidden > > I''ve Googled for "Rails Ajax toggled item" and got a number of hits > but no apparent answer. I''ll keep poking around the Web, but I > appreciate some suggestion(s). > > Thanks in advance, > Richard > > Showing app/views/expenses/new.html.erb where line #20 raised: > > compile error > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/views/expenses/ > new.html.erb:20: syntax error, unexpected tIDENTIFIER, expecting '')'' > @output_buffer.concat " "; @output_buffer.concat(( image_tag > "DownArrow.jpg" options > { onclick=page["vendor_droplist"].show } ).to_s); > @output_buffer.concat "\n" > > ^ > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/views/expenses/ > new.html.erb:20: odd number list for Hash > @output_buffer.concat " "; @output_buffer.concat(( image_tag > "DownArrow.jpg" options > { onclick=page["vendor_droplist"].show } ).to_s); > @output_buffer.concat "\n" > > ^ > > Extracted source (around line #20): > > 17: <p> > 18: <%= f.label :vendor %><br /> > 19: <%= f.text_field :vendor %> > 20: <%= image_tag "DownArrow.jpg" options > { onclick=page["vendor_droplist"].show } %> > 21: <br> > 22: <div name="vendor_droplist"> > 23: <%= select_tag "test", > > Trace of template inclusion: app/views/expenses/new.html.erb > > RAILS_ROOT: K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS > Application Trace | Framework Trace | Full Trace > > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/views/expenses/ > new.html.erb:59:in `compile!'' > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/controllers/ > expenses_controller.rb:30:in `new''-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
RichardOnRails
2010-Mar-21 05:02 UTC
Re: How to initially hide a drop-down control and have an image control make it visible
OK, I got rid of all the syntax errors. The vendor_drop list is now hidden on startup of the view I switched from an image to a button However, the drop list does not get displayed when the ShowList button is clicked Code is below. Ideas are most welcome <%= button_to_function("ShowList", %<page["vendor_droplist"].show> ) %> <br> <div id="vendor_droplist", style="display:none"> <%= select_tag "test", options_for_select(@current_vendors.collect { |v| v.nickname }), {:multiple => true} %> </div> On Mar 21, 12:37 am, RichardOnRails <RichardDummyMailbox58...-FtJgd9dCuO3JTKoYRCtP1UEOCMrvLtNR@public.gmane.org> wrote:> I think I improved two things in the version of lines 20-26 below: > 1. I gave the div an id rather than a name > 2. I gave the div a style of "display:none" so that it''s hidden at > every startup of the view > > <%# = image_tag "DownArrow.jpg" options > { onclick=page["vendor_droplist"].show } %> > <br> > <div id="vendor_droplist", style="display:none"> > <%= select_tag "test", > options_for_select(@current_vendors.collect { |v| > v.nickname }), > {:multiple => true} %> > </div> > > On Mar 21, 12:07 am, RichardOnRails > > <RichardDummyMailbox58...-FtJgd9dCuO3JTKoYRCtP1UEOCMrvLtNR@public.gmane.org> 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 } %> > > <br> > > <div name="vendor_droplist"> > > <%= select_tag "test", > > options_for_select(@current_vendors.collect { |v| > > v.nickname }), > > {:multiple => true} %> > > </div> > > > Until I put in the options on image tag and added the div, this code > > display a list of vendor nicknames. Now I have several problems: > > > 1. Syntax error in line 20 where an identifier was encountered where a > > right-paren was expected (see below) > > 2. I don''t know how to make the vendor_droplist initially hidden > > > I''ve Googled for "Rails Ajax toggled item" and got a number of hits > > but no apparent answer. I''ll keep poking around the Web, but I > > appreciate some suggestion(s). > > > Thanks in advance, > > Richard > > > Showing app/views/expenses/new.html.erb where line #20 raised: > > > compile error > > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/views/expenses/ > > new.html.erb:20: syntax error, unexpected tIDENTIFIER, expecting '')'' > > @output_buffer.concat " "; @output_buffer.concat(( image_tag > > "DownArrow.jpg" options > > { onclick=page["vendor_droplist"].show } ).to_s); > > @output_buffer.concat "\n" > > > ^ > > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/views/expenses/ > > new.html.erb:20: odd number list for Hash > > @output_buffer.concat " "; @output_buffer.concat(( image_tag > > "DownArrow.jpg" options > > { onclick=page["vendor_droplist"].show } ).to_s); > > @output_buffer.concat "\n" > > > ^ > > > Extracted source (around line #20): > > > 17: <p> > > 18: <%= f.label :vendor %><br /> > > 19: <%= f.text_field :vendor %> > > 20: <%= image_tag "DownArrow.jpg" options > > { onclick=page["vendor_droplist"].show } %> > > 21: <br> > > 22: <div name="vendor_droplist"> > > 23: <%= select_tag "test", > > > Trace of template inclusion: app/views/expenses/new.html.erb > > > RAILS_ROOT: K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS > > Application Trace | Framework Trace | Full Trace > > > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/views/expenses/ > > new.html.erb:59:in `compile!'' > > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/controllers/ > > expenses_controller.rb:30:in `new''-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Colin Law
2010-Mar-21 09:04 UTC
Re: How to initially hide a drop-down control and have an image control make it visible
On 21 March 2010 04:07, RichardOnRails <RichardDummyMailbox58407-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Colin Law
2010-Mar-21 09:11 UTC
Re: Re: How to initially hide a drop-down control and have an image control make it visible
On 21 March 2010 05:02, RichardOnRails <RichardDummyMailbox58407-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> wrote:> OK, I got rid of all the syntax errors. > The vendor_drop list is now hidden on startup of the view > I switched from an image to a button > However, the drop list does not get displayed when the ShowList button > is clicked > Code is below. Ideas are most welcome > > > <%= button_to_function("ShowList", > %<page["vendor_droplist"].show> ) %>Have you checked the html generated by the above to make sure it is generating what you expect? Colin> <br> > <div id="vendor_droplist", style="display:none"> > <%= select_tag "test", > options_for_select(@current_vendors.collect { |v| > v.nickname }), > {:multiple => true} %> > </div> > > > On Mar 21, 12:37 am, RichardOnRails > <RichardDummyMailbox58...-FtJgd9dCuO3JTKoYRCtP1UEOCMrvLtNR@public.gmane.org> wrote: >> I think I improved two things in the version of lines 20-26 below: >> 1. I gave the div an id rather than a name >> 2. I gave the div a style of "display:none" so that it''s hidden at >> every startup of the view >> >> <%# = image_tag "DownArrow.jpg" options >> { onclick=page["vendor_droplist"].show } %> >> <br> >> <div id="vendor_droplist", style="display:none"> >> <%= select_tag "test", >> options_for_select(@current_vendors.collect { |v| >> v.nickname }), >> {:multiple => true} %> >> </div> >> >> On Mar 21, 12:07 am, RichardOnRails >> >> <RichardDummyMailbox58...-FtJgd9dCuO3JTKoYRCtP1UEOCMrvLtNR@public.gmane.org> 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 } %> >> > <br> >> > <div name="vendor_droplist"> >> > <%= select_tag "test", >> > options_for_select(@current_vendors.collect { |v| >> > v.nickname }), >> > {:multiple => true} %> >> > </div> >> >> > Until I put in the options on image tag and added the div, this code >> > display a list of vendor nicknames. Now I have several problems: >> >> > 1. Syntax error in line 20 where an identifier was encountered where a >> > right-paren was expected (see below) >> > 2. I don''t know how to make the vendor_droplist initially hidden >> >> > I''ve Googled for "Rails Ajax toggled item" and got a number of hits >> > but no apparent answer. I''ll keep poking around the Web, but I >> > appreciate some suggestion(s). >> >> > Thanks in advance, >> > Richard >> >> > Showing app/views/expenses/new.html.erb where line #20 raised: >> >> > compile error >> > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/views/expenses/ >> > new.html.erb:20: syntax error, unexpected tIDENTIFIER, expecting '')'' >> > @output_buffer.concat " "; @output_buffer.concat(( image_tag >> > "DownArrow.jpg" options >> > { onclick=page["vendor_droplist"].show } ).to_s); >> > @output_buffer.concat "\n" >> >> > ^ >> > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/views/expenses/ >> > new.html.erb:20: odd number list for Hash >> > @output_buffer.concat " "; @output_buffer.concat(( image_tag >> > "DownArrow.jpg" options >> > { onclick=page["vendor_droplist"].show } ).to_s); >> > @output_buffer.concat "\n" >> >> > ^ >> >> > Extracted source (around line #20): >> >> > 17: <p> >> > 18: <%= f.label :vendor %><br /> >> > 19: <%= f.text_field :vendor %> >> > 20: <%= image_tag "DownArrow.jpg" options >> > { onclick=page["vendor_droplist"].show } %> >> > 21: <br> >> > 22: <div name="vendor_droplist"> >> > 23: <%= select_tag "test", >> >> > Trace of template inclusion: app/views/expenses/new.html.erb >> >> > RAILS_ROOT: K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS >> > Application Trace | Framework Trace | Full Trace >> >> > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/views/expenses/ >> > new.html.erb:59:in `compile!'' >> > K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/controllers/ >> > expenses_controller.rb:30:in `new'' > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
RichardOnRails
2010-Mar-21 10:49 UTC
Re: How to initially hide a drop-down control and have an image control make it visible
Hi Colin, Your "check the HTML" tip is *great* ... it''s now in my debugging arsenal.> comma missingThat 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...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 21 March 2010 04:07, RichardOnRails > > <RichardDummyMailbox58...-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Colin Law
2010-Mar-21 14:18 UTC
Re: Re: How to initially hide a drop-down control and have an image control make it visible
On 21 March 2010 10:49, RichardOnRails <RichardDummyMailbox58407-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> wrote:> Hi Colin, > > Your "check the HTML" tip is *great* ... it''s now in my debugging > arsenal.Another tip is to install the Html Validator add-on to Firefox and it will automatically validate your pages as you develop, this often shows up the reason why something is not working as you expect. 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
RichardOnRails
2010-Mar-22 20:35 UTC
Re: How to initially hide a drop-down control and have an image control make it visible
Hey Colin, Your "how''s the HTML" question really did the job: <div> tag not allowed within the scope of a <form> tag. Which means the my .erb can''t have: <% form_for(@expense) do |f| %> [snip] <div id="vendor_droplist" style="display:none"> <%= select_tag "test", options_for_select(@current_vendors.collect { |v| v.nickname }), {:multiple => true} %> </div> More importantly to me, it means that: <input onclick="page.toggle :vendor_droplist;" type="button" value="ShowList" /> won''t work inside that form. I''m going to post a new question on how to fix this while I scour the documentation to figure it out myself. Again, thank you for sharing your expertise with me, Richard On Mar 21, 10:18 am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 21 March 2010 10:49, RichardOnRails > > <RichardDummyMailbox58...-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> wrote: > > Hi Colin, > > > Your "check the HTML" tip is *great* ... it''s now in my debugging > > arsenal. > > Another tip is to install the Html Validator add-on to Firefox and it > will automatically validate your pages as you develop, this often > shows up the reason why something is not working as you expect. > > ColinOn Mar 21, 10:18 am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 21 March 2010 10:49, RichardOnRails > > <RichardDummyMailbox58...-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> wrote: > > Hi Colin, > > > Your "check the HTML" tip is *great* ... it''s now in my debugging > > arsenal. > > Another tip is to install the Html Validator add-on to Firefox and it > will automatically validate your pages as you develop, this often > shows up the reason why something is not working as you expect. > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Hassan Schroeder
2010-Mar-22 20:51 UTC
Re: Re: How to initially hide a drop-down control and have an image control make it visible
On Mon, Mar 22, 2010 at 1:35 PM, RichardOnRails <RichardDummyMailbox58407-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> wrote:> Your "how''s the HTML" question really did the job: > <div> tag not allowed within the scope of a <form> tag.What gives you that idea? It''s simply not true. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
RichardOnRails
2010-Mar-22 21:51 UTC
Re: How to initially hide a drop-down control and have an image control make it visible
Hi Hassan, Thanks for joining the conversation. I ran my the HTML page which was generated by my .erb. I had a form_for with an embedded div and the HTML page had an embedded div. W3C didn''t like it. The details are at http://www.pastie.org/881730. Now that I look at it again, perhaps the Object tag in place of the Div will work. Best wishes, Richard On Mar 22, 4:51 pm, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mon, Mar 22, 2010 at 1:35 PM, RichardOnRails > > <RichardDummyMailbox58...-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> wrote: > > Your "how''s the HTML" question really did the job: > > <div> tag not allowed within the scope of a <form> tag. > > What gives you that idea? It''s simply not true. > > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Michael Pavling
2010-Mar-22 22:02 UTC
Re: Re: How to initially hide a drop-down control and have an image control make it visible
On 22 March 2010 21:51, RichardOnRails <RichardDummyMailbox58407-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> wrote:> Hi Hassan, > > Thanks for joining the conversation. I ran my the HTML page which was > generated by my .erb. I had a form_for with an embedded div and the > HTML page had an embedded div. W3C didn''t like it. The details are > at http://www.pastie.org/881730. Now that I look at it again, > perhaps the Object tag in place of the Div will work.It''s not that you have a <form> with a nested <div> that the W3C is complaining at, it''s that you have a <p> with a nested <div> - lines 33 and 39 of your NewExpensePage.htm -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Hassan Schroeder
2010-Mar-22 22:11 UTC
Re: Re: How to initially hide a drop-down control and have an image control make it visible
On Mon, Mar 22, 2010 at 2:51 PM, RichardOnRails <RichardDummyMailbox58407-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> wrote:> Thanks for joining the conversation. I ran my the HTML page which was > generated by my .erb. I had a form_for with an embedded div and the > HTML page had an embedded div. W3C didn''t like it. The details are > at http://www.pastie.org/881730.Read line 11 of your validation pastie -- that is almost certainly your problem. Getting used to reading the HTML DTD(s) would be a good idea :-) -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
RichardOnRails
2010-Mar-23 07:14 UTC
Re: How to initially hide a drop-down control and have an image control make it visible
Great response, Michael. I now have a clean validation on the compiled code, but I''ve still got a problem. I''ve got clean code that validates. http://www.pastie.org/882256 displays: - new.html.erb - HTML generated for new.html.erb - Validation for generated html, which has one spurious (IMHO) warning The code that''s problematic for me is: <%# This begins the vendor-name code %> <%= 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 "list", options_for_select(@current_vendors), :multiple => true, :size => 3 %> </div> <%# This is the end of the vendor-name code %> The vendor_droplist without the style allows vendors to be displayed in a drop-down-style list. With the "hide style", I expected that clicking the ShowList button would cause the list to be displayed, but that does not happen. Do you any further idea about how to get that button working? Thanks in Advance for any other ideas you may have. On Mar 22, 6:02 pm, Michael Pavling <pavl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 22 March 2010 21:51, RichardOnRails > > <RichardDummyMailbox58...-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> wrote: > > Hi Hassan, > > > Thanks for joining the conversation. I ran my the HTML page which was > > generated by my .erb. I had a form_for with an embedded div and the > > HTML page had an embedded div. W3C didn''t like it. The details are > > athttp://www.pastie.org/881730. Now that I look at it again, > > perhaps the Object tag in place of the Div will work. > > It''s not that you have a <form> with a nested <div> that the W3C is > complaining at, it''s that you have a <p> with a nested <div> - lines > 33 and 39 of your NewExpensePage.htmOn Mar 22, 6:02 pm, Michael Pavling <pavl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 22 March 2010 21:51, RichardOnRails > > <RichardDummyMailbox58...-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> wrote: > > Hi Hassan, > > > Thanks for joining the conversation. I ran my the HTML page which was > > generated by my .erb. I had a form_for with an embedded div and the > > HTML page had an embedded div. W3C didn''t like it. The details are > > athttp://www.pastie.org/881730. Now that I look at it again, > > perhaps the Object tag in place of the Div will work. > > It''s not that you have a <form> with a nested <div> that the W3C is > complaining at, it''s that you have a <p> with a nested <div> - lines > 33 and 39 of your NewExpensePage.htm-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
RichardOnRails
2010-Mar-23 07:15 UTC
Re: How to initially hide a drop-down control and have an image control make it visible
Hi Hassan, please take a look at my reply to Michael. On Mar 22, 6:11 pm, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mon, Mar 22, 2010 at 2:51 PM, RichardOnRails > > <RichardDummyMailbox58...-gP6xRNRnnqSxhq/XJNNIW0EOCMrvLtNR@public.gmane.org> wrote: > > Thanks for joining the conversation. I ran my the HTML page which was > > generated by my .erb. I had a form_for with an embedded div and the > > HTML page had an embedded div. W3C didn''t like it. The details are > > athttp://www.pastie.org/881730. > > Read line 11 of your validation pastie -- that is almost certainly your > problem. > > Getting used to reading the HTML DTD(s) would be a good idea :-) > > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.