On Sun, Dec 13, 2009 at 9:08 PM, Todd <ojint...@gmail.com> wrote:

> Looking to properly label my radios with <label for="inputid"></
> label><input id="inputid" />.  Here's my current snippet:
>
> def create(xhtml: NodeSeq) : NodeSeq = {
>
>            def submitHandler() = {
>               S.redirectTo("/createSuccess?name=" + name.is);
>        }
>
>            var chosenMethod: Box[ContestType.Value] = Empty
>
>                return bind("createForm", xhtml, "name" -> SHtml.text(
> name.is, name
> (_)),
>            "type"   -> SHtml.radio(
>                        ContestType.elements.toList.map(_.toString),
>                        Empty,
>                        selected => chosenMethod = Box(ContestType.valueOf
> (selected)), {"id" -> {var i = 1; i.toString()}}
>            ).flatMap(choice => (<span>{choice.xhtml} <label
> for='type'>{choice.key.toString}</label></span>)),
>                        "submit" -> SHtml.submit("Submit", submitHandler _)
>                )
>        }
>

val radios: ChoiceHolder[String] = SHtml.radio(elements, callBack)
val radioHtml: NodeSeq = radios.items.toList.zipWithIndex.map{case (choice,
idx) => <span>{choice.xhtml} <label id={idx.toString}
for='type'>{choice.key.toString}</label></span>


>
> So to highlight the important bits : i.toString() was the beginnings
> to test out how the attributes got applied to each radio.  What I end
> up with is a bunch of <input name="CRAZYINTERNALLIFT#" id="1" /> where
> the id doesn't change from 1, which is expected.  But I'm thinking
> that the additional attributes passed into the SHtml.radio button get
> applied to each input tag and are evaluated immediately, not when they
> are applied to each tag.  Am I wrong?
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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