Thankyou, maybe I can get rid of my own code enhancement now

On Wed, Sep 17, 2008 at 6:58 AM, David Pollak <[EMAIL PROTECTED]> wrote:

>
>
> Jorge Ortiz wrote:
>
> The mixinAttributes function is now in BindHelpers.
>
>
>
> Excellent!  Thanks!
>
>
> --j
>
> On Fri, Aug 15, 2008 at 7:06 AM, David Pollak<[EMAIL PROTECTED]> <[EMAIL 
> PROTECTED]> wrote:
>
>
> On Thu, Aug 14, 2008 at 10:42 AM, Jorge Ortiz <[EMAIL PROTECTED]> <[EMAIL 
> PROTECTED]> wrote:
>
>
> The abstraction for it isn't baked into lift, but because Scala is a
> functional, high-level language it's not hard to write it as an
> abstraction yourself.
>
>
> The way we've been growing Lift is to find abstractions that are used in the
> wild, generalizing them, and making them part of Lift.
>
> This one strikes me as something that should be rolled in.  Jorge -- want to
> add the code?
>
>
>
>  def mixinAttributes(out: Elem)(in: NodeSeq): NodeSeq =
>    in.firstOption.map(out % _.attributes).getOrElse(out)
>
> Then you can do:
>
>  bind("hello", xhtml,
>          "email" --> mixinAttributes(SHtml.text(email, email = _)))
>
> You can even give it a shorter name if you want.
>
> --j
>
> On Thu, Aug 14, 2008 at 7:46 AM, Oliver Lambert <[EMAIL PROTECTED]> <[EMAIL 
> PROTECTED]> wrote:
>
>
> Good to know its possible though it looks like a little work to set up
> as a default.
>
> On 14/08/2008, at 8:43 PM, Jorge Ortiz wrote:
>
>
>
> Try passing a NodeSeq => NodeSeq function to bind, like so:
>
> bind("hello", xhtml,
>        "email" --> (inputField: NodeSeq) => { /* extract attributes
> from inputField and mix into result from SHtml.text */ })
>
> inputField should get bound to whatever is inside the <hello:email>
> tags in your xhtml (in this case, <input ...>)
>
> --j
>
> On Wed, Aug 13, 2008 at 11:22 PM, Oliver <[EMAIL PROTECTED]> <[EMAIL 
> PROTECTED]> wrote:
>
>
> Suppose I have the following snippet of html
> </td><td><hello:email><input maxlength="50" size="35"
> id="email"/></hello:email></td>
>
> and the following snippet of a snippet
> bind("hello", xhtml,
>        "email" --> text(email, email = _),
> ...
>
> The SHtml.text method overwrites the input html inside
> <hello:email> getting
> rid of my maxlength and size.
> Is there any way to keep my current attributes and combine them
> with the
> SHtml.text output?
>
> I know I can call '% ("size" -> "10")' on the function, but I would
> rather
> have most of my html in a text file.
>
> cheers
> Oliver
>
>
>
>               --
> lift, the simply functional web framework http://liftweb.net
> Collaborative Task Management http://much4.us
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to