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>

> 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
> (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

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to