without load and without akcje.load i can see the blocking message, but there is no unblock
if request.vars.a == 'restart': form=FORM(TR('Wybierz VPS',SELECT(ipvps,_name='ip', requires=IS_IN_SET(ipvps))), TR('',INPUT(_type='submit'), formstyle='ul'),_id='staty') if form.accepts(request,session): import time time.sleep(2) response.flash = 'restart form accepted' rest=str(iphostserv[request.vars.ip]) + "veid" + str(vids[request.vars.ip]) and view: {{if request.vars.a == 'restart':}} <h3>Restart action</h3> {{=form}} {{=rest}} but then browser isn't unblocked. The javascript is working, because I get it from previus version of panel written in php. On 3 Lis, 15:46, Anthony <abasta...@gmail.com> wrote: > Nothing jumps out. Doesn't look like a web2py issue, though. I think you'll > just have to debug your JS code. Are you sure it's getting to the $.blockUI > call (i.e., it's not returning in the preceding if clause)? > > > > > > > > On Thursday, November 3, 2011 9:54:30 AM UTC-4, brushek wrote: > > > I have following javascript function: > > > (function($) { > > $.fn.pytacz = function(options) { > > var opts = $.extend({}, $.fn.pytacz.defaults, options); > > var details = $('.details'); > > > opts.message_txt = opts.message_txt.replace('[msg]', > > opts.tekst_czekania); > > > return this.submit(function(e) { > > e.preventDefault(); > > > if(opts.pytac && !confirm(opts.pytanie) ) { > > return false; > > } > > $.blockUI({ message: opts.message_txt}); > > //setTimeout($.unblockUI, 4000); > > //$.unblockUI(); > > > $.post($(this).attr('action'), $(this).serialize(), > > function(data) { > > details.html(data).queue(function () { > > $.unblockUI(); > > $(this).show("blind"); > > $(this).dequeue(); > > }); > > $('a:last', details).click(function() { > > details.hide("fold"); > > }); > > }); > > }); > > } > > $.fn.pytacz.defaults = { > > pytanie: 'Zrestartować ?', > > tekst_czekania: "Proszę czekać ...", > > pytac: true, > > message_txt: '<h1><img src="images/busy.gif" />[msg]</h1>' > > } > > })(jQuery); > > > And this function is applied to id 'staty' (which is id of form): > > > $(document).ready(function(){ > > > $(".details").hide(); > > $(".details").fadeIn("slow"); > > > $('#staty').pytacz({ pytanie: 'Czy zrestartować ?', tekst_czekania: > > 'Proszę czekać. Restart w toku ...' }); > > > }); > > > On 3 Lis, 01:18, Anthony <abas...@gmail.com> wrote: > > > Looks like the component will only load if request.vars.a='restart' -- > > is > > > the main page visited with '?a=restart' in the URL? Where/how are you > > > invoking BlockUI? > > > > On Wednesday, November 2, 2011 5:16:42 AM UTC-4, brushek wrote: > > > > > here is controller (sleep is for emulating long lasting action): > > > > > def akcje(): > > > > [...] > > > > if request.vars.a == 'restart': > > > > form=FORM(TR('Wybierz VPS',SELECT(ipvps,_name='ip', > > > > requires=IS_IN_SET(ipvps))), > > > > TR('',INPUT(_type='submit'), > > > > formstyle='ul'),_id='staty') > > > > if form.accepts(request,session): > > > > import time > > > > time.sleep(5) > > > > response.flash = 'restart form accepted' > > > > rest=str(iphostserv[request.vars.ip]) + "veid" + > > > > str(vids[request.vars.ip]) > > > > elif form.errors: > > > > response.flash = 'form has errors' > > > > else: > > > > response.flash = 'please fill the form' > > > > > and akcje.load: > > > > > {{left_sidebar_enabled=right_sidebar_enabled=False}} > > > > {{#extend 'layout.html'}} > > > > > {{#if 'message' in globals():}} > > > > > {{if request.vars.a == 'restart':}} > > > > {{=form}} > > > > {{=rest}} > > > > > and akcje.html: > > > > > {{left_sidebar_enabled=right_sidebar_enabled=False}} > > > > {{extend 'layout.html'}} > > > > > {{#if 'message' in globals():}} > > > > > <h1>Akcje</h1> > > > > <hr /> > > > > {{if request.vars.a == 'restart':}} > > > > <h3>Restart action</h3> > > > {{=LOAD('default','akcje.load',vars={'a':'restart'},content='Poczekaj...',ajax=True)}} > > > > > On 2 Lis, 02:41, Anthony <aba...@gmail.com> wrote: > > > > > Can you show some code? > > > > > > On Tuesday, November 1, 2011 6:47:13 PM UTC-4, brushek wrote: > > > > > > > Ok, thanks for answer. I would like to use this plugin with LOAD > > > > > > helper. How can I connect LOAD with blockUI ? When I use load, > > then I > > > > > > can't make blockUI working (I want to ask user before send the > > > > > > validated form wheter do the action (by javascript confirm()) and > > make > > > > > > him waiting with blocked browser with 'Operation in progress...' > > text > > > > > > for a while (by blockUI). > > > > > > > On 1 Lis, 13:39, Anthony <aba...@gmail.com> wrote: > > > > > > > blockUI is just a client-side jQuery plugin, so just follow the > > > > usual > > > > > > > instructions:http://jquery.malsup.com/block/. I don't think > > there's > > > > > > > anything special about using it with web2py. > > > > > > > > On Tuesday, November 1, 2011 8:34:42 AM UTC-4, brushek wrote: > > > > > > > > > Hello, > > > > > > > > > I would like to use jquery blockUI with web2py for long time > > > > action. > > > > > > > > Can You give me some example/advice, how to do this with > > web2py > > > > using > > > > > > > > web2py's ajax or jQuery in the best-fashion manner ? > > > > > > > > > regards > > > > > > > > brushek