password input custom
Greetings
In my User.scala file:
I'm using the next class to customize the password input
The code is the next
import net.liftweb.mapper.MappedPassword
[...]
class User extends MegaProtoUser[User] {
[...]
override def _toForm: Box[NodeSeq] = {
S.fmapFunc({s: List[String] => this.setFromAny(s)}){funcName =>
Full(
<tr>
开发者_如何转开发 <td>{S.??("repeat")}</td>
<td><input id={fieldId} type='password' name={funcName} value={is.toString}/> </td>
</tr>
<tr>
<td>{S.??("repeat")}<td>
<td><input type='password' name={funcName} value={is.toString}/></td>
</tr>
)
}
}
[...]
}
the compiler displays the following error:
[ERROR] ....../org/santix/model/User.scala:209: error: value setFromAny is not a member of org.santix.model.User
[INFO] S.fmapFunc({s: List[String] => this.setFromAny(s)}){funcName =>
anyone have any idea?
There's just too little information to answer, but I can see some points here...
First, I imagine you might be copying from some example, since you use this.setFromAny
. The code containing this snippet is inside the class User
, which extends MegaProtoUser[User]
. Alas, MegaProtoUser
does not have any method setFromAny
, and I imagine your own class User
doesn't either, and this is the primary cause of the error.
Now, setFromAny
is part of the class MappedPassword
, which you import, but doesn't seem to use in any place, so I don't know why you imported it. However, I can see that MegaProtoUser
has a member which returns a MappedPassword
. This member is called password
, so I imagine this might work:
S.fmapFunc({s: List[String] => this.password.setFromAny(s)}){funcName =>
PROBLEM SOLVED!!!!
class User extends MegaProtoUser[User] {
...
override lazy val password = new MyPassword(this) {
override def _toForm: Box[NodeSeq] = {
S.fmapFunc({s: List[String] => this.setFromAny(s)})
{funcName =>
Full(
<tr>
<td>{ passwordDisplayName }</td>
<td>
<input id={fieldId} type='password' name={funcName} value=''/>
<!-- by sanx, value={is.toString} -->
</td>
</tr>
<tr>
<td>{S.??("repeat")}</td>
<td>
<input type='password' name={funcName} value=''/>
</td>
</tr>
)
}
}
}
}
精彩评论