I am following the book example with modified tables, the form is not being
processed in the controller, what could be wrong with my code below:

*db.py [Model]*

db.define_table("address",
                    Field("street", requires=IS_NOT_EMPTY()),
                    Field("suburb", requires = IS_NOT_EMPTY()),
                    Field("town", requires = IS_NOT_EMPTY()),
                    Field("province", requires = IS_NOT_EMPTY()))

*default.py [Controller]*

def add_address():
    form = SQLFORM(db.address)
    if form.process(session=None, formname="test").accepted:
        response.flash = "Address added"
    elif form.errors:
        response.flash = "Form has errors"
    else:
        response.flash = "Fill in form"
    return dict()

*add_address.html [View]*

{{extend "layout.html"}}
<form>
    <table>
        <tr>
            <td>Enter street: </td><td><input type="text" name="street"
/></td>
        </tr>
        <tr>
            <td>Enter suburb: </td><td><input type="text" name="suburb"
/></td>
        </tr>
        <tr>
            <td>Enter town: </td><td><input type="text" name="town" /></td>
        </tr>
        <tr>
            <td>Enter province: </td><td><input type="text"
 name="province" /></td>
        </tr>
        <tr>
            <td colspan = "2"><input type="submit" /></td>
        </tr>
    </table>
    <input type="hidden" name="_formname" value="test" />
</form>


Regards, Teddy L.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to