Of course you can access it from the snippet. But if you want it to be output automatically, then you prefix it with whatever the node's prefix is. In other words, by default it's not outputted.
------------------------------------- David Pollak<[email protected]> wrote: On Thu, Aug 13, 2009 at 9:06 PM, Naftoli Gugenheim <[email protected]>wrote: > > What I would like to do: > <label for="name">Name</label> <person:name I'd="name" size="10" > class="special" style="vertical-align: top" maxlength="5" tabindex="1" /> > Okay, just a little contrived... > My understanding is you can do this by prefixing the attribute with > "lift:"; otherwise it will not be output but is available to the snippet > code, i.e., without the prefix you are making an attribute available to the > snippet but that's it. I'm sorry, but I'm still clueless about what you're talking about. Do you want to bind to <person:name/> and add the attributes in the <person:name /> element to the resulting element? The lift prefix has nothing to do with binding. Binding is done in net.liftweb.util and is purely a way of substituting dynamic XML into well defined points in a NodeSeq. So... if you want to include the attributes of an Elem that you are replacing during a bind operation, you have access to the current node via Helpers.currentNode: Box[Elem] and you can get the attributes: currentNode.map(_.attributes) openOr Null > > I'm getting this from Exploring Lift page 115. > > > > ------------------------------------- > David Pollak<[email protected]> wrote: > > On Thu, Aug 13, 2009 at 7:24 PM, Naftoli Gugenheim <[email protected] > >wrote: > > > > > Why was the decision made, if I understand correctly, that normal > > attributes are not preserved in a bound node, and are are only available > for > > the snippet's usage, and if you want the attribute to be "sticky" you > have > > to prefix it with "lift:"? Wouldn't it be better the other way? > > > I don't understand your question. Are you talking about Helpers.bind() or > are you talking about snippet dispatching? > > Can you please provide an example of what happens now and what you would > expect to happen? > > > > > > One of lift's design goals is to help keep the static html in the view > and > > the logic in the code, and to provide a templating system that doesn't > > interfere with visual web designers. It seems to me that it would further > > this goal if html attributes could be properly specified in the view > html. > > > > > > > > > > > > -- > 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 -~----------~----~----~----~------~----~------~--~---
