Sorry or spaming the list :)

Here's yet another version:

Create a form that contains 4 fields:
- login
- password
- password_repeat
- email

and the following validation function:

process_form(A) ->
     F = fun(A, Field) ->
             {ok, Val} = yaws_api:postvar(A, Field),
             L = string:len(Val),
             if
                L < 4 orelse L > 16 ->
                     {Field, {length}};
                 true ->
                     {}
             end
         end,

        buktu_form:validate(A, [
                                {login, F},
                                 {email},
                                 {password, {'=', password_repeat}}
                                ]).

If you fail to fill any fields at all you'll get:
[{login,[{invalid_field}]},
{email,[absent]},
{password,[{invalid_field,password_repeat}]}]
If you input login of incorrect length or different passwords:
[{login,{length}},
{password,[{not_equal,password_repeat}]}]
That's it so far :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"erlyweb" 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/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to