Hey John,
form.notnull is an example of a built-in validator that the web.py Form
module uses to verify the contents of the form when you form
form.validates().  Form.notnull means the value inside that particular
input element must be not null in order to validate properly.

You don't need to use form.notnull, but its convenient - and there can be
more than one validator.  See this example for reference:

    form.Textbox("bax",
        form.notnull,
        form.regexp('\d+', 'Must be a digit'),
        form.Validator('Must be more than 5', lambda x:int(x)>5))

from: http://webpy.org/form#example

That has 3 different validators notnull, a regex and a length check.
 Validators come first in the form elements argument list, then optional
arguments like pre, post, class, etc. follow.
On Wed, May 9, 2012 at 11:29 PM, John Sullivan <[email protected]> wrote:

> Hello,
>
> I have searched through much of the mailing list, all of the
> documentation I could find, Google, and tried the freenode channel
> (which seems to be dead). I can not find out what the purpose is of
> having form.notnull inside of the form objects' constructors. The only
> description of it that I could find is at webpy.org/form#inputfeatures
> but it wasn't very clear:
>
> form.textbox("firstname",
>    form.notnull, #put validators first followed by optional
> attributes
>    class_="textEntry", #gives a class name to the text box -- note
> the underscore
>    pre="pre", #directly before the text box
>    post="post", #directly after the text box
>    description="please enter your name", #describes field, defaults
> to form name ("firstname")
>    value="bob", #default value
>    id="nameid", #specify the id
> )
>
> Could anyone tell me what the purpose of form.notnull is? Or point me
> to some literature I missed that explains it to me?
>
> --
> You received this message because you are subscribed to the Google Groups
> "web.py" 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/webpy?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en.

Reply via email to