>From a syntactic point of view clearly something is wrong here:
<a href="#" ,id="div_{{=i.uuid}}" {{args=[i.id]}}>
because here args appear to be a local variable in the view and it is
unused.

The problem is that I do not understand what you want to achieve. You
have a list of messages and a link "click to add a message" that opens
a modal containing a form. Why do you have a lick "click to add a
message" for each past message? Anyway you have many such links but a
single modal. How should the modal know which of the links caused the
modal to open? This all happens client-side all the logic has to be in
JS. Yet it seems to me you should have one one link and one form.
Perhaps I misundrstand.

On Apr 25, 4:55 am, ChrisM <[email protected]> wrote:
> 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