## Caveat beware sloppy syntax below
## DO NOT forget to validate!!

def add_my_field(form):
  form.vars.myfield = request.post_vars.myfield

# After defining the form but before returning the dict
if form[0].process(onvalidation=add_my_field)....
On Feb 21, 10:09 am, whowhywhat <[email protected]> wrote:
> anybody .. please .. pretty please :)..
>
> On Feb 21, 10:20 am, whowhywhat <[email protected]> wrote:
>
>
>
>
>
>
>
> > I need a web2py SQLFORM.grid to accept and process based on some
> > conditions, which need to be triggered based on some check boxes. I
> > have inserted these checkboxes into the form by doing something like :
>
> > In the controller -
>
> > def my_grid():
> > form = SQLFORM.grid(....)
>
> > if  len(request.args)>1 and (request.args[0]=='new' or 'edit') and
> > (form.create_form or form.edit_form):
> >         my_extra_element = TR(TD(LABEL('Process x:'),
> > _class='w2p_fl'), INPUT(_name='Do X', default=False,
> >             _value='on', _type='checkbox',_id='process_x'))
> >     if form.create_form:
> >         form.create_form[0].insert(-1,my_extra_element)
> >     if form.edit_form:
> >         form.edit_form[0].insert(-1,my_extra_element)
> >     if request.post_vars: session.tmp = request.post_vars
> > return dict(form=form)
>
> > Adding the custom elements is straight forward and easy..
> > Is there some way to store and pass the value of the custom inserted
> > check-box or any such customized form?
> > I have tried many things.. but have not been successful so far.
> > Any help is greatly appreciated :) ..

Reply via email to