I wonder if anyone has an example of putting up a modal dialog with 
w2.jqplugins.ui.DialogWidget.  I would like to put up a dialog with Save 
and Cancel buttons, which would be displayed when one of the submit buttons 
for a form is clicked.  I'm using TG 2.3 and TW2.

I can get the dialog to display, but there are a couple of things I can't 
get to work...

If it try to set the {'autoOpen' : False} option, the dialog won't display 
at all.  If I don't specify this then it's always displayed.

The buttons in the dialog don't run their Javascript in their 'click' 
options.  Instead the Firebug console displays "TypeError: d.click.apply is 
not a function".

I haven't been able to get the form's submit buttons to bring up the dialog 
either.

Here's are the relevant bits of code:

import tw2.core as twc
import tw2.forms as twf

from tw2.jqplugins.ui import DialogWidget

class ConfirmDialogWidget(DialogWidget):
    
    pass

class QuestionForm(twf.TableForm):
        
    id = twf.HiddenField()

    dialog = ConfirmDialogWidget(id='dialog', name='dialog', label='',
                                 options={'modal' : True,
                                          'title' : 'Confirm save',
                                          'autoOpen' : False,
                                          'buttons' : [ {'text' : "Save", 
'click' : 'function() { $( this ).dialog( "close" ); }'},
                                                        {'text' : "Cancel", 
'click' : 'function() { $( this ).dialog( "close" ); }'}
                                                        ]})


    submit = None
    submit1 = twf.SubmitButton(name='saveForLater', value='Save for later', 
attrs={'onClick' : '$( this ).dialog( "open" );' })
    submit2 = twf.SubmitButton(name='saveAndSubmit', value='Save and 
submit', attrs={'onClick' : '$( this ).dialog( "open" );' })

    action = 'saveGrades'

Any help appreciated.

Matthew

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to