Hi,

I am trying to create a dynamic custom form (see below), but I have several 
problems:

1) the form doesn't update if the value in n_sets is changed: the 
request.vars.n_set is only called once and it refers to the previous form 
submission
2) submit doesn't save to the database: I think that the problem might be 
connected with the fact that points_set is a 'list:integer' (it is this way 
because the number of sets is variable)
3) I am not able to remove the +- button: I don't need them since the 
number of list items is defined by the n_sets value 

Any suggestion?

Thanks!

db.define_table('points',
    Field('n_sets','integer',default=2,requires=(IS_NOT_EMPTY(),
IS_INT_IN_RANGE(1,10))),
    Field('points_set','list:integer'))


def log_results():
    form = SQLFORM(db.points)
return dict(form=form)


{{=form.custom.begin}}
    Sets: <div>{{=form.custom.widget.n_sets}}</div>
   
    {{for i in range(int(request.vars.n_sets)):}}
        Points set {{=i+1}}: <div>{{=form.custom.widget.points_set}}</div>
    {{pass}}

    {{=form.custom.submit}}
{{=form.custom.end}}

<https://lh3.googleusercontent.com/-G6rSj2CoWqE/WBdZpFl4scI/AAAAAAAAG0s/aZ4Tc_gOR6cYttU-n5uaedxVYsIuQfezQCLcB/s1600/Screen%2BShot%2B2016-10-31%2Bat%2B16.46.48.png>


-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to