Thank you. it's a lot easier, yeah :) On Mon, Apr 13, 2009 at 10:51 PM, Charles F. Munat <c...@munat.com> wrote: > > Good point. You could do all the label stuff in the template, which is > probably easier. > > Chas. > > Dmitry Lipovoi wrote: >> ... or You can set element's id manually in template: >> >> <lift:someSnippet form="post"> >> <p> >> <label for="username">Username</label> >> <br/> >> <f:username f:id="username"><input id="username" type="text" >> name="username" value="username"/></f:url> >> </p> >> <p> >> <f:submit><input type="submit" value="Do It!"/></f:submit> >> </p> >> </lift:someSnippet> >> >> >> On Mon, Apr 13, 2009 at 11:58 PM, Charles F. Munat <c...@munat.com> wrote: >>> The "for" attribute in the <label> element points at the <input> >>> element's *id*, not it's name. Also, where is the label? You've got an >>> element, but no label (unless I'm still asleep). >>> >>> http://www.w3.org/TR/html401/interact/forms.html#h-17.9.1 >>> >>> So this is actually quite easy: >>> >>> bind("login", xhtml, >>> "username" -> <label for="username">Username {SHtml.text(username, >>> username = _, ("id", "username"))}</label>, >>> ... >>> >>> That names for the inputs are generated doesn't matter because the for >>> attribute refers to the id, not the name. >>> >>> You could, of course, use David's method but add something that sets the >>> id attribute = the name attribute since the name is going to be unique >>> on the page. >>> >>> Chas. >>> >>> João Pereira wrote: >>>> it's looks great and works great too. :) >>>> >>>> thank you >>>> >>>> On Mon, Apr 13, 2009 at 5:18 PM, David Pollak >>>> <feeder.of.the.be...@gmail.com <mailto:feeder.of.the.be...@gmail.com>> >>>> wrote: >>>> >>>> def label(in: Elem): NodeSeq = <label for={in \ "@name"} /> ++ in >>>> >>>> bind("login", xhtml, >>>> "username" -> label(SHtml.text(username, username(_))) >>>> >>>> How does that look? >>>> >>>> 2009/4/13 João Pereira <joaomiguel.pere...@gmail.com >>>> <mailto:joaomiguel.pere...@gmail.com>> >>>> >>>> Hello, >>>> >>>> I have the following snippet: >>>> >>>> HTML: >>>> >>>> <div id="login"><lift:login.login form="post"> >>>> <login:username /> >>>> <login:password /> >>>> <login:submit /> >>>> </lift:login.login></div> >>>> >>>> Scala: >>>> >>>> bind("login", xhtml, >>>> "username"->SHtml.text(username,username(_)), >>>> "password"->SHtml.text(password, password(_)), >>>> "submit" ->SHtml.submit("login", authenticate)) >>>> >>>> >>>> Rendered HTML is: >>>> >>>> <div id="login"><form method="post" action="/login"> >>>> <input name="F1177922287215MUE" type="text" value="zxczxc" /> >>>> <input name="F1177922287216DXQ" type="text" value="zxcczx" /> >>>> <input name="F1177922287217EXX" type="submit" value="login" /> >>>> </form></div> >>>> >>>> >>>> What is the best strategy to have a <label for="..."> HTML tag >>>> rendered for each input field? >>>> >>>> The desired output will be: >>>> >>>> <div id="login"><form method="post" action="/login"> >>>> *<label for="F1177922287215MUE"/>* >>>> <input name="F1177922287215MUE" type="text" value="zxczxc" /> >>>> *<label for="F1177922287216DXQ"/>* >>>> <input name="F1177922287216DXQ" type="text" value="zxcczx" /> >>>> <input name="F1177922287217EXX" type="submit" value="login" /> >>>> </form></div> >>>> >>>> >>>> thanks >>>> -- >>>> João Miguel Pereira, PMP >>>> http://jpereira.eu >>>> http://www.linkedin.com/in/joaomiguelpereira >>>> joaomiguel.pere...@gmail.com <mailto:joaomiguel.pere...@gmail.com> >>>> (351) 96 275 68 58 >>>> >>>> >>>> >>>> >>>> >>>> -- >>>> Lift, the simply functional web framework http://liftweb.net >>>> Beginning Scala http://www.apress.com/book/view/1430219890 >>>> Follow me: http://twitter.com/dpp >>>> Git some: http://github.com/dpp >>>> >>>> >>>> >>>> >>>> >>>> -- >>>> João Miguel Pereira, PMP >>>> http://jpereira.eu >>>> http://www.linkedin.com/in/joaomiguelpereira >>>> joaomiguel.pere...@gmail.com <mailto:joaomiguel.pere...@gmail.com> >>>> (351) 96 275 68 58 >>>> >> >> > > > > >
-- João Miguel Pereira, PMP http://jpereira.eu http://www.linkedin.com/in/joaomiguelpereira joaomiguel.pere...@gmail.com (351) 96 275 68 58 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---