In following test app I have a single form in a jquery modal dialog.
I have a selection set, I click on one of the selection and
the form opens, I need to pass the correct args to the controller on
submission.
Confused as to correct/best method for this. I know I can do it with
iframes in the
dialog but there must be a better way?

in model I have:
db.define_table('test',
 
SQLField('uuid',length=128,writable=False,default=str(uuid.uuid4())),
    SQLField('timestamp','datetime',default=now),
    SQLField('message','string')
    SQLField('name','string'))

in controller:
def index()
 
set=db(db.test.id>0).select(db.test.ALL,orderby=~db.test.timestamp)

    form=SQLFORM.factory(db.test,fields=['message'])
        if form.accepts(request.vars,session):
        db.test.id.default==request.args[0]).select()[0]
        for row in db(db.test.id==form.vars.message).select():
            row.update_record(message = form.vars.message)
return dict(form=form,set=set)


I have a test index page:
{{extend 'layout.html'}}
<script type="text/javascript"
src="{{=URL(r=request,c='static',f='jquery.ui.core.js')}}"></script>
<script type="text/javascript">
{{for i in set:}}

$('#div_{{=i.uuid}}').click(function() {
$('#dialog').dialog({"autoOpen": "false", "width": "600px"});
$('#dialog').dialog('open'); return false;
});

{{pass}}
</script>

{{for i in set:}}
<div>
<div>{{=i.name}}</div>
<a href="#" ,id="div_{{=i.uuid}}" {{args=[i.id]}}>"click to add
messasge"</a></div
</div>
{{pass}}


<div  id="dialog" style="display: none;" title="test form">

{{=form}}
</div>

get error ticket as index for args


Help / advise appreciated
Chrism




-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en

Reply via email to