On Thu, Nov 12, 2009 at 11:49 AM, Jim Barrows <[email protected]> wrote:
> I'm importing HttpHelpers, and the implicit is not there.
> Did this change for M7?
I think what you want is:
"firstName" -> (SHtml.text(person.firstName, person.firstName = _) % ("id"
-> "firstName") % ("disabled" -> disabledAttr))
>
>
> On Mon, Nov 9, 2009 at 6:41 PM, Ross Mellgren <[email protected]> wrote:
>
>>
>> Use None (Option) or Empty (Box) as the value of the attribute -- this
>> will cause the pairToUnprefixed implicit that is being used inside
>> SHtml to not generate an attribute.
>>
>> e.g.:
>>
>> val disableAttr: Box[String] = if (disableAll) Full("disabled") else
>> Empty
>>
>> bind("person", xhtml,
>> ...
>> "firstName" -> SHtml.text(person.firstName, person.firstName =
>> _, "id" -> "firstName", "disabled" -> disableAttr),
>> ...)
>>
>> -Ross
>>
>>
>> On Nov 9, 2009, at 6:51 PM, Jim Barrows wrote:
>>
>> > I found this answer on nabble but it's regarding setting the values
>> > client side. I want to set them in the snippet, depending on data.
>> > This doesn't work, but will give you a better idea of what I'm
>> > trying to do:
>> > def bindPerson(xhtml: NodeSeq, action: () => Unit,
>> > submitButtonName: String, disableAll: boolean): NodeSeq = {
>> > // Hold a val here so that the "id" closure holds it when we re-
>> > enter this method
>> > val currentId = person.id
>> > val disableString :String = disableAll match {
>> > case true => "disabled"
>> > case false => ""
>> > }
>> > bind("person", xhtml,
>> > "id" -> SHtml.hidden(() => person.id = currentId),
>> > // "version" -> SHtml.hidden(() => person.version),
>> > "firstName" -> SHtml.text(person.firstName, person.firstName =
>> > _, "id" -> "firstName", "disabled" -> disableString),
>> > "middleName" -> SHtml.text(person.middleName,
>> > person.middleName = _, "id" -> "middleName", "disabled" ->
>> > disableString),
>> > "lastName" -> SHtml.text(person.lastName, person.lastName = _,
>> > "id" -> "lastName", "disabled" -> disableString),
>> > "submit" -> SHtml.submit(?(submitButtonName), action))
>> > }
>> >
>> > --
>> > James A Barrows
>> >
>> >
>> > >
>>
>>
>>
>>
>
>
> --
> James A Barrows
>
>
> >
>
--
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 [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
-~----------~----~----~----~------~----~------~--~---