The reason I am asking is because I want to generate a bunch of forms
based on data in the database and have them all show up on the screen
at one time and be updateable.  I can get all of the forms to show up
on the screen and I can fill them out; however, they all make the
first one submit.  Is there a way make each one submit correctly
without defining all of the forms in the controller?

The way I am doing it now is defining several forms in html for
several rows in the database:

<h4>Modify Existing Function Tests</h4>
{{for i in db(db.post.test_case==request.args[0]).select():}}
 <form id="myform{{=i.id}}" name="myform{{=i.id}}">
   <textarea name="functionality" id="functionality"
class="functionality" >{{=i.functionality}}</textarea>
   <textarea name="task" id="task" class="task" >{{=i.task}}</
textarea>
   <textarea name="expected_result" id="expected_result"
class="expected_result">{{=i.expected_result}}</textarea>
   {{=SELECT(test_case_status, value=i.test_status,
_name='test_status', _id='test_status', _class='test_status')}}
   <textarea name="regression" id="regression" class="regression">
{{=i.regression}}</textarea>
   <textarea name="comments" id="comments" class="comments">
{{=i.comments}}</textarea>
   {{=INPUT(_type='checkbox', _name='affects_clients',
_id='affects_clients', _class='affects_clients',
_value=i.affects_clients)}}
   {{=INPUT(_type='checkbox', _name='client_acceptance_test',
_id='client_acceptance_test', _class='client_acceptance_test',
_value=i.client_acceptance_test)}}
   <input name="_formname" type="hidden" value="post{{=i.id}}" />
   <input type="hidden" value="{{=i.id}}" name="id" id="id" />
   <input type="hidden" value="{{=request.args[0]}}" name="test_case"
id="test_case" />
   <input type="submit"/>
 </form>
 <div id="target">{{=i.id}}</div>

 <script>
  $('#myform{{=i.id}}').submit(function() {
     ajax('{{=URL(r=request,f='new_post')}}',['id', 'test_case',
'functionality', 'task', 'expected_result', 'test_status',
'regression', 'comments', 'affects_clients',
'client_acceptance_test'],'target');
     return false;
   });
 </script>
 {{pass}}

I'm using the ajax function to submit the form to a different
controller which looks like this:
def new_post():
    record=db(db.post.id==request.vars.id).select()
    form = SQLFORM(db.post, record[0])
    if form.accepts(request.vars,formname=None):
        return '%s updated' % request.vars.id
    elif form.errors:
        return TABLE(*[TR(k,v) for k,v in form.errors.items()])

Does anyone have any ideas on how I can do this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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