OK. After you declare the form but before you process it you can set the form.vars.FieldName property. I think that might help.
On Wed, 8 Jul 2020, 4:36 am Anusha Narayan, <[email protected]> wrote: > Yeah! The first question, is what I am talking about. > > On Mon, 6 Jul 2020, 8:56 pm AGRogers, <[email protected]> wrote: > >> Do you mean you want to set the EVENT_ID so that it's already selected >> when the form opens? >> >> Or are you saying that after you select the Event and submit the form you >> get an error? >> >> On Sat, 4 Jul 2020, 3:27 pm Anusha Narayan, <[email protected]> >> wrote: >> >>> *The code of my model db.py is:* >>> >>> db.define_table( >>> 'event_table', >>> Field('event_name'), >>> Field('organizer_name'), >>> ) >>> >>> db.define_table('category', >>> Field('Category_name',requires=IS_NOT_EMPTY()), >>> Field('Event_id',db.event_table) >>> ) >>> >>> *The controller looks like:* >>> >>> def category(): >>> >>> form=SQLFORM(db.category) >>> if form.process().accepted: >>> response.flash='form has accepted' >>> else: >>> response.flash='form has errors' >>> return dict() >>> >>> >>> *The code for the view (default/category.html) is:* >>> >>> {{extend 'layout.html'}} >>> >>> >>> >>> <form action="#" enctype="multipart/form-data" method="post"><ul> >>> >>> <li>category name: <input name="Category_name" >>> value="{{=request.args(0)}}"/></li> >>> <li>event_id type: <input name="Event_id" ></li></ul> >>> <input type="submit" value="Submit" /> >>> </form> >>> >>> >>> *(Here I am trying to pass the event id through the request argument of the >>> URL. But when I submit the form, it says "form has errors". Why is that >>> happening? I am not able to understand.?* >>> >>> -- >>> Resources: >>> - http://web2py.com >>> - http://web2py.com/book (Documentation) >>> - http://github.com/web2py/web2py (Source code) >>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>> --- >>> 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]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/web2py/38a3a4ba-7887-415a-8409-f5f28170d178o%40googlegroups.com >>> <https://groups.google.com/d/msgid/web2py/38a3a4ba-7887-415a-8409-f5f28170d178o%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> 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]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/web2py/CACWMBMNsEm9rXYFhd7e8Bh6jK9wix%2ByUdZ5BunMT%3Dnef92mGPg%40mail.gmail.com >> <https://groups.google.com/d/msgid/web2py/CACWMBMNsEm9rXYFhd7e8Bh6jK9wix%2ByUdZ5BunMT%3Dnef92mGPg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > 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]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/CAPf%3DStg%3DQEP%2B5VCTBpuohbSVEjY%3DueYvjzBRsJzseQ4nKTBWWA%40mail.gmail.com > <https://groups.google.com/d/msgid/web2py/CAPf%3DStg%3DQEP%2B5VCTBpuohbSVEjY%3DueYvjzBRsJzseQ4nKTBWWA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CACWMBMONiteBodmSUNt2j-HWUwt%2BN_bcQDjkbFqPsR4_XHeGgw%40mail.gmail.com.

