"#isShared" #> SHtml.checkbox(isSharedRV.is, processIsShared(_))
.map(x => x.asInstanceOf[scala.xml.Elem] % ("disabled" -> (if (!isOwner) "disabled" else Empty)))
The trick that's being used here is that if you call '% ("disabled -> Empty)' on an Elem then the 'disabled' attribute gets ignore altogether.
However, the complicating factor is that SHtml.checkbox returns a NodeSeq rather than an Elem, so you can't apply the % operator directly as you could with, say, SHtml.text.
It feels a bit too clunky. Is there a better / easier way that I've missed?
Thanks
Damian
I want to add the 'disabled' attribute to a SHtml.checkbox based on a conditional check.The only way I've found so far is:
"#isShared" #> SHtml.checkbox(isSharedRV.is, processIsShared(_))
.map(x => x.asInstanceOf[scala.xml.Elem] % ("disabled" -> (if (!isOwner) "disabled" else Empty)))The trick that's being used here is that if you call '% ("disabled -> Empty)' on an Elem then the 'disabled' attribute gets ignore altogether.
However, the complicating factor is that SHtml.checkbox returns a NodeSeq rather than an Elem, so you can't apply the % operator directly as you could with, say, SHtml.text.
It feels a bit too clunky. Is there a better / easier way that I've missed?
Thanks
Damian
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code