I''ve noticed that it is common practise in forms to use: <label for="tablename","columnname"> ...Some column name</label> Why is the above construct better than just writting it this way? <label> Some column name</label> If there is not compelling reason, I''d prefer to use the second example and save on typing. -- Best Regards, -Larry "Work, work, work...there is no satisfactory alternative." --- E.Taft Benson -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060702/bfc9128c/attachment-0001.html
> <label for="tablename","columnname"> ...Some column name</label> > > Why is the above construct better than just writting it this way?The ''for'' attribute specifies which input field the label refers to. This is an HTML thing rather than specifically Rails. It''s an accessbility feature, generally important for voice and text browers. Also, if you click a label that has a ''for'' attribute, the assocatied input field will be selected. Steve -- Posted via http://www.ruby-forum.com/.
OK, its worth a little extra typing for accessibility. Is there a way to change the associated input field''s background color ? -Larry On 7/2/06, Stephen Bartholomew <steve@2404.co.uk> wrote:> > > <label for="tablename","columnname"> ...Some column name</label> > > > > Why is the above construct better than just writting it this way? > The ''for'' attribute specifies which input field the label refers to. > This is an HTML thing rather than specifically Rails. > > It''s an accessbility feature, generally important for voice and text > browers. > > Also, if you click a label that has a ''for'' attribute, the assocatied > input field will be selected. > > Steve > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Best Regards, -Larry "Work, work, work...there is no satisfactory alternative." --- E.Taft Benson -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060702/b0d87a40/attachment.html
On 02 Jul 2006, at 18:00, Larry Kelly wrote:> OK, its worth a little extra typing for accessibility. > > Is there a way to change the associated input field''s background > color ? >input:focus, textarea:focus { background-color: #ffc; } or just input, textarea { background-color: #ffc; } That''s for the browsers that support it of course (i.e. you can forget about :focus on Internet Exploder) Best regards Peter De Berdt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060710/1fa6b75e/attachment.html
you could hack together support for it in internet explorer using event listeners (onfocus, etc), temporarily adding a "focus" classname while the form element is focused. the last part is pretty simple with prototype, ie: Element.classNames( "my_form_input" ).add( "focus" ); and the CSS: input.focus, textarea.focus { background-color: #ffc; } Peter De Berdt wrote:> > On 02 Jul 2006, at 18:00, Larry Kelly wrote: > >> OK, its worth a little extra typing for accessibility. >> >> Is there a way to change the associated input field''s background color ? >> > > input:focus, textarea:focus { > background-color: #ffc; > } > > or just > input, textarea { > background-color: #ffc; > } > > That''s for the browsers that support it of course (i.e. you can forget > about :focus on Internet Exploder) > > > Best regards > > > Peter De Berdt > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >