On Thu, Jun 18, 2009 at 11:27 AM, Kris Nuttycombe <[email protected]
> wrote:

>
> Though that's undeniably a bit of a rabbit hole, it would also be the
> fully general solution and could have really interesting applications
> in terms of being able to bind not just full NodeSeqs but individual
> attributes, and even attributes in multiple nodes. Sounds like an
> exciting feature to me!


You can bind to attributes right now.  You just need to use AttrBindParam
or FuncAttrBindParam on the right side of the ->


>
>
> onward and xbindward,
>
> Kris
>
> On Wed, Jun 17, 2009 at 5:29 PM, David
> Pollak<[email protected]> wrote:
> > Crud... adding xpathisms to bind... where will it end? :-)
> >
> >
> >
> > On Wed, Jun 17, 2009 at 3:41 PM, Kevin Wright
> > <[email protected]> wrote:
> >>
> >> One possibility I already considered is something like:
> >> bind(nodeseq, "prefix",
> >>     "suffix" -> Text("matched an element"),
> >>     "@suffix" -> Text("matched an attribute"),
> >>     "@suffix=value" -> Text("matched an attribute with specified
> value"));
> >> the bindings here would respectively match the elements:
> >> <prefix:suffix>content</prefix:suffix>
> >> <span prefix:suffix="placeholder">content</span>
> >> <span prefix:suffix="value">content</span>
> >>
> >> Use of the span elements above was an arbitrary choice
> >> What's missing is an intuitive way to access the node that has been
> bound,
> >> especially if you only want to change the contents
> >>
> >> On Wed, Jun 17, 2009 at 10:19 PM, David Pollak
> >> <[email protected]> wrote:
> >>>
> >>>
> >>> On Wed, Jun 17, 2009 at 2:07 PM, Kris Nuttycombe
> >>> <[email protected]> wrote:
> >>>>
> >>>> We'd still need some attribute to disambiguate in the case of multiple
> >>>> textarea tags, wouldn't we?
> >>>
> >>> I don't think so. The only NodeSeq being passed to the function is the
> >>> NodeSeq inside the tag that's getting bound to.
> >>>>
> >>>>
> >>>> Kris
> >>>>
> >>>> On Wed, Jun 17, 2009 at 2:51 PM, David
> >>>> Pollak<[email protected]> wrote:
> >>>> > I can see a set of methods that look like:
> >>>> > textarea(f: String => Unit)(n: NodeSeq) that will slurp the values
> and
> >>>> > attributes out of the NodeSeq... so you'd bind like:
> >>>> > "biography" -> textarea(s => setBio(s)) _
> >>>> >
> >>>> > On Wed, Jun 17, 2009 at 10:22 AM, Matt Williams <
> [email protected]>
> >>>> > wrote:
> >>>> >>
> >>>> >> I wholeheartedly agree with the philosophy of separating the
> display
> >>>> >> from the program logic, and am currently getting to grips with the
> >>>> >> generators, but am finding that now I end up with a degree of
> markup
> >>>> >> within my code.
> >>>> >>
> >>>> >> Can you think of any caveats to infering the node type passed, and
> >>>> >> dynamically using the relevant generators to construct the returned
> >>>> >> node.
> >>>> >>
> >>>> >> I am thinking something along the lines of:
> >>>> >>
> >>>> >> <person:biography>
> >>>> >> <textarea style="myStyle" cols="20" rows="5">
> >>>> >> This is a sample of some biography text
> >>>> >> </textarea>
> >>>> >> </person:biography>
> >>>> >>
> >>>> >> Where it would automatically infer that it is a textarea, pass
> >>>> >> through
> >>>> >> the relevant attributes, and insert whatever function, values, etc
> I
> >>>> >> have specified in my snippet.
> >>>> >>
> >>>> >> What are your thoughts on this?
> >>>> >>
> >>>> >> Brgds,
> >>>> >>
> >>>> >> Matt
> >>>> >>
> >>>> >>
> >>>> >>
> >>>> >
> >>>> >
> >>>> >
> >>>> > --
> >>>> > 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
> >>>> >
> >>>> > >
> >>>> >
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> 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
> >>>
> >>>
> >>
> >>
> >>
> >
> >
> >
> > --
> > 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
> >
> > >
> >
>
> >
>


-- 
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to