It works perfectly. Thanks very much Anthony.

Sushant: I didn't want to change my code to an ajax form. I wanted to
keep it the way it was. Thanks for your suggestion anyway.

Regards.

2012/3/27 Anthony <[email protected]>:
> Yes, response.js only works for requests for components (made via a
> client-side call to web2py_ajax_page(), which is called when you use the
> LOAD helper in the view). You might try something like this:
>
> def index():
>     ...
>     if form.accepts(request.vars):
>         js = SCRIPT('$(function() {$("#dialog-message").dialog({modal:
> true});});', _type='text/javascript')
>     else:
>         js = ''
>     ...
>     return dict(form=form, js=js)
>
> and then somewhere in your index.html view:
>
> {{=js}}
>
> Anthony
>
>
> On Tuesday, March 27, 2012 8:31:14 AM UTC-4, José L. wrote:
>>
>> Hi, I'm having problems trying to show a modal window after the user
>> submits correctly a form.
>> I've tried to do it with:
>>
>> def index():
>> ....
>>         if form.accepts(request.vars):
>>             response.js='$( "#dialog-message" ).dialog({ modal: true
>> });'
>> ...
>>
>> being #dialog-message a div in the same index.html page, but response.js
>> doesn't do anything, and it seems to work only inside componentes.
>>
>> Any idea to get this funcionality working?
>> Thanks.

Reply via email to