It works now.
For displaying the message next to the text field, you were very
close. The only difference is that instead of "nickname" it should
have been "users_nickname". This is because the unique id is generated
by prepending the containing object's DB table ("users") with an
underscore.
On Sun, Feb 7, 2010 at 6:58 PM, Richard Hirsch <[email protected]> wrote:
> Thanks
>
> On Sun, Feb 7, 2010 at 5:46 PM, Vassil Dichev <[email protected]> wrote:
>> In general, you have to publish the messages which are to appear in
>> <lift:msgs/> via S.error, S.notice, etc. I'll see what I can do to
>> make it work tonight.
>>
>>
>> On Sun, Feb 7, 2010 at 12:37 PM, Richard Hirsch <[email protected]>
>> wrote:
>>> Hi,
>>>
>>> I did some quick hacking regarding this bug.
>>>
>>> scala routines in User.scala are being called but they are either not
>>> working correctly or their results are not be displayed. The
>>> information from the upw_sign_form.html are working correctly and the
>>> reason why the messages for the bottom half of the signup page are
>>> displayed is unknown. One reason may be that the lift:msg tags (for
>>> example, <lift:msg id="nickname"/>) are missing from the signup.html
>>> file. I added them but it still doesn't work.
>>>
>>> Maybe someone else can take a look and see if they see what the prob is.
>>>
>>> D.
>>>
>>> ---------------
>>>
>>> User.scala
>>>
>>> private def validateNickname(str: String): List[FieldError] = {
>>> val others = getSingleton.findByNickname(str).
>>> // getSingleton.findAll(By(getSingleton.nickname, str)).
>>> filter(_.id.is != fieldOwner.id.is)
>>> others.map(u => FieldError(this, <xml:group>Duplicate nickname:
>>> {str}</xml:group>))
>>> }
>>>
>>> private def validText(str: String): List[FieldError] =
>>> if (ValidNickName(str)) Nil
>>> else List(FieldError(this,
>>> <xml:group>Invalid nickname. Must start with
>>> a letter and contain only letters,
>>> numbers or "_"</xml:group>))
>>>
>>> override def validations = validText _ :: validateNickname _ ::
>>> super.validations
>>>
>>> signup.html
>>>
>>> <label for="nickname">
>>> <lift:loc>ui_sign_up_nickname</lift:loc>
>>> <br/>
>>> <signup:nickname/> <lift:msg id="nickname"/>
>>> </label>
>>>
>>> lift:msg tags are missing
>>>
>>
>