Greetings to all
I'm trying to define the "WSHtml" trait that extends SHtml and
implements the radio and radio_* method:
the code here:
http://pastie.org/4002175
package code
package lib
import scala.xml._
import net.liftweb.http.SHtml
import net.liftweb.common._
import net.liftweb.http.S._
trait WSHtml extends SHtml {
override def radio(opts: Seq[(String, String)], deflt: Box[String],
func: String => Any, attrs: ElemAttr*): ChoiceHolder[String] =
radio_*(opts, deflt, SFuncHolder(func), attrs: _*)
override def radio_*(opts: Seq[(String, String)], deflt:
Box[String], func: AFuncHolder, attrs: ElemAttr*):
ChoiceHolder[String] = {
fmapFunc(func) {
name =>
val itemList = opts.flatMap{
case (value, text) =>
ChoiceItem(
text,attrs.foldLeft(<input type="radio" name={name}
value={value}/>)(_ % _) %
checked(deflt.filter((s: String) => s == value).isDefined)
)
}
ChoiceHolder(itemList)
}
}
}
but sends me the following error:
[error] /home/hector/lift/produccion/portal/src/main/scala/code/lib/
WSHtml.scala:23: type mismatch;
[error] found : WSHtml.this.ElemAttr
[error] required: scala.xml.MetaData
[error] text,attrs.foldLeft(<input type="radio"
name={name} value={value}/>)(_ % _) %
[error]
^
[error] one error found
do not know if this is the best way to do this
but can someone tell me I'm doing wrong or what I need