Need to see the model to make sure but try replace

    CodeOF=request.vars.OF

with

    CodeOF=request.vars.OF or request.vars.META_OF

The problem that when the second form is submitted vars.OF is None so
there no record to edit.

On Mar 12, 2:03 pm, JmiXIII <sylvn.p...@gmail.com> wrote:
> I'm facing a pb with the following controller :
>
> # Formulaire de saisie principal
>
> from gluon.tools import Crud
>
> crud = Crud(globals(), db)
>
> def saisie():
>
>     listeOF=db(db.GPOF.id>0).select()
>
>     CodeOF=request.vars.OF
>
>     Selection=FORM('Code OF:',
> INPUT(_name='OF',_value=CodeOF,requires=IS_IN_DB(db, 'GPOF.OF_CODE')),
>
>                                INPUT(_type='submit',_value='Cliquer
> pour afficher'))
>
>     if Selection.accepts(request.vars,keepvalues=True):
>
>         pass
>
>     MetaOF=db(db.OF.META_OF==CodeOF).select() #Sélection des données
> méta de l'OF (démarrage, responsable...)
>
>     if len(MetaOF):
>
>         MetaForm=SQLFORM(db.OF,record=MetaOF[0],deletable=True)
>
>     else:
>
>         MetaForm=SQLFORM(db.OF)
>
>     if MetaForm.accepts(request.vars,session):
>
>         response.flash = 'Données saisies'
>
>     return dict(Selection=Selection,MetaForm=MetaForm)
>
> The selection form works well and helps filtering data (this
> controller is extracted from a bigger one).
> When len(MetaOF)=0 , it's ok , a new record is inserted
> When len(MetaOF)=1, it render the right record but if I try to modify
> it , it doesn't work (no error message) but no response.flash neither
>
> Could you help me understant what's wrong....
>
> Thanks
>
> JmiXIII

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to