Of course if you want it simpler just use:

bind("f", xhtml,
     "query" -> SHtml.text(query, query = _),
     "submit" -> SHtml.submit("Submit", processSearch)
)

<lift:MyItems.search form="POST">
Query:<br />
<f:query f:id="hello"/>
</lift:MyItems.search>

and Lift will automatically merge the attributes for you ;)

Br's,
Marius

On Mar 27, 9:40 pm, "marius d." <marius.dan...@gmail.com> wrote:
> If I may you can also use something like:
>
> bind("f", xhtml,
>      "query" -> {n: NodeSeq => (for (node <- BindHelpers.currentNode)
> yield BindHelpers.mixinAttributes(SHtml.text(query, query = _))(node))
> open_! },
>      "submit" -> SHtml.submit("Submit", processSearch)
> )
>
> <lift:MyItems.search form="POST">
> Query:<br />
> <f:query id="hellp"/>
> </lift:MyItems.search>
>
> the difference is that we passed the id directly to f:query without
> duplicating the input tag.
>
> Br's,
> Marius
>
> On Mar 27, 3:12 pm, bradford <fingerm...@gmail.com> wrote:
>
> > Hi Timothy,
>
> > Thanks for your response.  After I posted this message I realized that
> > JavaRebel failed to reload a class.  I restarted the application and
> > the code works now.  This thread did not appear in the list at that
> > time (due to moderation perhaps) so I could not reply to it in time.
>
> > Yes, I'm aware that you can set the attributes that way, but I prefer
> > to set it in the HTML.  I just find it easier to work with CSS that
> > way.  I guess it's a personal preference.  Anyway, mixinAttributes is
> > very cool.
>
> > Thanks for your help,
> > Bradford
>
> > On Mar 27, 6:10 am, Timothy Perrett <timo...@getintheloop.eu> wrote:
>
> > > Hi Bradford,
>
> > > Can you just elaborate on what your trying to achieve? My assumption
> > > is that you want to set the ID of the input field?
> > > When your working with lift you dont need to define the input fields
> > > in the HTML, only on the serverside.
>
> > > Try this:
>
> > > bind("f", xhtml,
> > >      "query" -> SHtml.text(query, query = _) % "id" -> "hello"
> > >      "submit" -> SHtml.submit("Submit", processSearch)
> > > )
> > > <lift:MyItems.search form="POST">
> > > Query:<br />
> > > <f:query />
> > > </lift:MyItems.search>
>
> > > On Mar 27, 2:28 am, bradford <fingerm...@gmail.com> wrote:
>
> > > > I'm trying to use mixinAttributes, but get a scala.MatchError:
> > > > <function> (full error below).  I'm using the 1.1 snapshot.
>
> > > > bind("f", xhtml,
> > > >      "query" -> mixinAttributes(SHtml.text(query, query = _)) _,
> > > >      "submit" -> SHtml.submit("Submit", processSearch)
> > > > )
>
> > > > <lift:MyItems.search form="POST">
> > > > Query:<br />
> > > > <f:query><input id="hello" /></f:query>
> > > > </lift:MyItems.search>
>
> > > > Can someone please let me know if I'm doing something wrong.
>
> > > > Message: scala.MatchError: <function>
> > > >         scala.runtime.ScalaRunTime$.boxArray(ScalaRunTime.scala:135)
> > > >         
> > > > net.liftweb.util.BindHelpers$FuncBindParam.value(BindHelpers.scala:
> > > > 217)
> > > >         net.liftweb.util.BindHelpers$FuncBindParam.calcValue
> > > > (BindHelpers.scala:218)
> > > >         
> > > > net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind$1$1$
> > > > $anonfun$apply$8.apply(BindHelpers.scala:419)
> > > >         
> > > > net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind$1$1$
> > > > $anonfun$apply$8.apply(BindHelpers.scala:414)
> > > >         net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
> > > >         net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind
> > > > $1$1.apply(BindHelpers.scala:413)
> > > >         net.liftweb.util.BindHelpers$$anonfun$bind$2$$anonfun$in_bind
> > > > $1$1.apply(BindHelpers.scala:412)
> > > >         scala.Seq$class.flatMap(Seq.scala:294)
> > > >         scala.xml.NodeSeq.flatMap(NodeSeq.scala:34)
> > > >         net.liftweb.util.BindHelpers$$anonfun$bind$2.in_bind$1
> > > > (BindHelpers.scala:412)
> > > >         
> > > > net.liftweb.util.BindHelpers$$anonfun$bind$2.apply(BindHelpers.scala:
> > > > 429)
> > > >         
> > > > net.liftweb.util.BindHelpers$$anonfun$bind$2.apply(BindHelpers.scala:
> > > > 397)
> > > >         net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
> > > >         net.liftweb.util.BindHelpers$class.bind(BindHelpers.scala:397)
> > > >         net.liftweb.util.BindHelpers$.bind(BindHelpers.scala:72)
> > > >         net.liftweb.util.BindHelpers$class.bind(BindHelpers.scala:368)
> > > >         net.liftweb.util.BindHelpers$.bind(BindHelpers.scala:72)
--~--~---------~--~----~------------~-------~--~----~
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