[web2py] Re: SQLFORM return javascript on accept

2016-04-28 Thread Anthony
If the form action itself is loaded in an iframe, then it won't work, as 
response.js is only executed at the end of Ajax requests. Is there any 
reason it needs to be loaded in an iframe rather than via a standard Ajax 
request?

It might help if you show more of the relevant code.

Anthony

On Thursday, April 28, 2016 at 8:32:29 AM UTC-4, Mark Billion wrote:
>
> Thats brilliant, but when I put it in the script in, it doesnt work:
>
> ajax_form = SQLFORM(db[field_array[3]], this_page_ajax, deletable=True)
> 
> if ajax_form.process().accepted:
> response.js = 'alert("hi");'
>
> The form is being called thru a modal and ajax iframe, but even when I 
> just call it alone, it doesnt work:
>
> $('.iframe_input').click(function(){
> var element = $(this).attr('name');
> $('#iframe_target').html('https://104.131.18.58/t3/default/ajax_form_creator?all='+element +'" 
> frameborder="0" width="580" height="300" scrolling="yes" 
> id="myFrame">');
>
> });
>  
>
> On Wednesday, April 27, 2016 at 6:15:43 PM UTC-4, Leonel Câmara wrote:
>>
>> Hey Mark,
>>
>> Use response.js for that
>>
>> If form.process().accepted:
>>
>> #dont reload
>>
>> response.js = """
>> $("#iframe_modal").remove();
>> $('.modal-dialog').remove();
>> """
>>
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SQLFORM return javascript on accept

2016-04-28 Thread Mark Billion
Thats brilliant, but when I put it in the script in, it doesnt work:

ajax_form = SQLFORM(db[field_array[3]], this_page_ajax, deletable=True)

if ajax_form.process().accepted:
response.js = 'alert("hi");'

The form is being called thru a modal and ajax iframe, but even when I just 
call it alone, it doesnt work:

$('.iframe_input').click(function(){
var element = $(this).attr('name');
$('#iframe_target').html('https://104.131.18.58/t3/default/ajax_form_creator?all='+element +'" 
frameborder="0" width="580" height="300" scrolling="yes" 
id="myFrame">');

});
 

On Wednesday, April 27, 2016 at 6:15:43 PM UTC-4, Leonel Câmara wrote:
>
> Hey Mark,
>
> Use response.js for that
>
> If form.process().accepted:
>
> #dont reload
>
> response.js = """
> $("#iframe_modal").remove();
> $('.modal-dialog').remove();
> """
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SQLFORM return javascript on accept

2016-04-27 Thread Leonel Câmara
Hey Mark,

Use response.js for that

If form.process().accepted:

#dont reload

response.js = """
$("#iframe_modal").remove();
$('.modal-dialog').remove();
"""



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.