the table:
db.define_table('users',
SQLField('user_name','string',required=True,unique=True),
SQLField('password','password',length=80,required=True),
SQLField('town_id','integer'), # this can be NULL
SQLField('name','string',required=True),
SQLField('gender',requires=IS_IN_SET(['male','female'])),
SQLField('telephone','string'),
SQLField('cellphone','string'),
SQLField('grade','integer',default=3) #user's grade, 1-admin 2-normal
3-viewer
)
the action:
def add_user():
...
# print response.vars I CAN see the storage returned contains the
correct information .
form=form(db.users,formname=None):
if form.accepts(request.vars,session):
response.message='User added!'
elif form.errors:
response.message='There are some errors when adding user to the
database!'
else:
response.message='Please filling the form.'
return dict()
the view:
....
<input type="text" id='users_user_name' name='user_name' value=''/>
...
<select id="users_grade" name="grade">
<option value='1'> admin</option>
...
</select>
....
Thank Massimo for your GREAT work! :)
2009/7/17 mdipierro <[email protected]>
>
> On Jul 16, 11:47 am, Artman <[email protected]> wrote:
> > Hi. I'm trying to take advantage of SQLFORM but without returning it
> > to the view where I placed a custom form. But when I submit the form,
> > everything seems to be ok, no form.errors. But the data hasn't sent to
> > the database! I'm sure I'm following the convention to naming the
> > input tag and the Storage post back correctly. Anybody can help me? In
> > my custome form, I have changed a text-input-tag into a <select>,
> > where the values are stored in <option> tag. Is it the problem?
>
> It could be but I cannot say without looking at the code. If you could
> post the model, validators, action and view, I may be able to help
> more.
>
> Massimo
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---