In the controller which is called when you submit the form, you can do any
database access you want.
Use the data from the form to Select the other data you need (possibly from
other tables) and use that as values for db(resources).insert(...)

Hope it helps
Tiago Almeida
-------------

On Tue, Jan 19, 2010 at 5:34 AM, Adi <[email protected]> wrote:

> There's a database table db.resources which I wish to update. But I
> need to include SELECT element in the form, so I cannot use the
> default SQLFORM(db.resources) thing. Same limitation with crud.
>
> I can't just change FORM to SQLFORM. What's the way?
>
> On Jan 18, 8:29 pm, mdipierro <[email protected]> wrote:
> > Tiago is correct. You have FORM, SQLFORM, SQLFORM.factory,
> > crud.create, crud.update, etc.
> >
> > FORM itself does not update database because it has no knowledge of
> > it.
> >
> > What is your database table that you want to be updated?
> >
> > On Jan 18, 8:27 am, tiago almeida <[email protected]> wrote:
> >
> > > I may be wrong but I believe the FORM is just an html helper, try using
> an
> > > SQLForm.
> >
> > > Cya
> > > --
> >
> > > On Mon, Jan 18, 2010 at 10:17 AM, Adi <[email protected]> wrote:
> > > > web2py version: 1.74.6 (2010-01-13 11:12:48)
> > > > operating system: Ubuntu 9.10 karmic
> > > > database: SQLite
> >
> > > > Hi all,
> >
> > > > I've got a simple form which is not submitting its data to the
> > > > database. Here's the code snippet:
> >
> > > > def resources():
> > > >    """
> > > >    allows add/update/delete for resources
> > > >    """
> > > >    # form for creating a resource
> > > >    form = FORM(TABLE(TR('Name:',INPUT(_type='text', _name='name',
> > > > requires=IS_NOT_EMPTY())),
> > > >                        TR("Email:",INPUT
> > > > (_type="text",_name="email",requires=IS_EMAIL())),
> > > >                        TR("Active status:",INPUT
> > > > (_type="checkbox",_name="active_status", value=True)),
> > > >                        TR("Resource type:",SELECT
> > > > ('Transcriber','QA',_name="resource_type",requires=IS_IN_SET
> > > > (['Transcriber','QA']))),
> > > >                        TR("",INPUT(_type="submit",_value="Submit"))))
> > > >    if form.accepts(request.vars, session):
> > > >        session.flash = 'Resource created successfully!'
> > > >        redirect(URL(r=request, f='resources'))
> > > >    elif form.errors:
> > > >        session.flash = 'Some error occured.'
> >
> > > >    return dict(form = form)
> >
> > > > When I enter data I see "Resource created successfully!" message
> > > > (which means there's no validation failure) but the data is not going
> > > > into the database (verified from database administration). Any clue
> > > > what might be wrong?
> >
> > > > --
> > > > 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]<web2py%[email protected]>
> <web2py%[email protected]<web2py%[email protected]>
> >
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/web2py?hl=en.
>
> --
> 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]<web2py%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>
>
>
--
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.

Reply via email to