diff --git a/applications/admin/static/js/web2py.js b/applications/admin/static/js/web2py.js index 2e463733..257f87cd 100644 --- a/applications/admin/static/js/web2py.js +++ b/applications/admin/static/js/web2py.js @@ -490,12 +490,12 @@ * and prevent clicking on it */ disableElement: function(el) { el.addClass('disabled'); - var method = el.is('button') ? 'html' : 'val'; + var method = el.is('input') ? 'val' : 'html'; //method = el.attr('name') ? 'html' : 'val'; var disable_with_message = (typeof w2p_ajax_disable_with_message != 'undefined') ? w2p_ajax_disable_with_message : "Working..."; /*store enabled state if not already disabled */ - if(el.data('w2p:enable-with') === undefined) { - el.data('w2p:enable-with', el[method]()); + if(el.data('w2p_enable_with') === undefined) { + el.data('w2p_enable_with', el[method]()); } /*if you don't want to see "working..." on buttons, replace the following * two lines with this one @@ -515,11 +515,11 @@ /* restore element to its original state which was disabled by 'disableElement' above*/ enableElement: function(el) { - var method = el.is('button') ? 'val' : 'html'; - if(el.data('w2p:enable-with') !== undefined) { + var method = el.is('input') ? 'val' : 'html'; + if(el.data('w2p_enable_with') !== undefined) { /* set to old enabled state */ - el[method](el.data('w2p:enable-with')); - el.removeData('w2p:enable-with'); + el[method](el.data('w2p_enable_with')); + el.removeData('w2p_enable_with'); } el.removeClass('disabled'); el.unbind('click.w2pDisable'); @@ -586,12 +586,14 @@ if(pre_call != undefined) { eval(pre_call); } - if(confirm_message != undefined) { - if(confirm_message == 'default') confirm_message = w2p_ajax_confirm_message || 'Are you sure you want to delete this object?'; - if(!web2py.confirm(confirm_message)) { - web2py.stopEverything(e); - return; - } + if(confirm_message) { + if(confirm_message == 'default') + confirm_message = w2p_ajax_confirm_message || + 'Are you sure you want to delete this object?'; + if(!web2py.confirm(confirm_message)) { + web2py.stopEverything(e); + return; + } } if(target == undefined) { if(method == 'GET') { @@ -634,7 +636,7 @@ }); }, /* Disables form elements: - - Caches element value in 'w2p:enable-with' data store + - Caches element value in 'w2p_enable_with' data store - Replaces element text with value of 'data-disable-with' attribute - Sets disabled property to true */ @@ -646,8 +648,8 @@ if(disable_with == undefined) { element.data('w2p_disable_with', element[method]()) } - if(element.data('w2p:enable-with') === undefined) { - element.data('w2p:enable-with', element[method]()); + if(element.data('w2p_enable_with') === undefined) { + element.data('w2p_enable_with', element[method]()); } element[method](element.data('w2p_disable_with')); element.prop('disabled', true); @@ -655,16 +657,16 @@ }, /* Re-enables disabled form elements: - - Replaces element text with cached value from 'w2p:enable-with' data store (created in `disableFormElements`) + - Replaces element text with cached value from 'w2p_enable_with' data store (created in `disableFormElements`) - Sets disabled property to false */ enableFormElements: function(form) { form.find(web2py.enableSelector).each(function() { var element = $(this), method = element.is('button') ? 'html' : 'val'; - if(element.data('w2p:enable-with')) { - element[method](element.data('w2p:enable-with')); - element.removeData('w2p:enable-with'); + if(element.data('w2p_enable_with')) { + element[method](element.data('w2p_enable_with')); + element.removeData('w2p_enable_with'); } element.prop('disabled', false); }); @@ -730,4 +732,4 @@ web2py_event_handlers = jQuery.web2py.event_handlers; web2py_trap_link = jQuery.web2py.trap_link; web2py_calc_entropy = jQuery.web2py.calc_entropy; */ -/* compatibility code - end*/ \ No newline at end of file +/* compatibility code - end*/ diff --git a/applications/examples/static/js/web2py.js b/applications/examples/static/js/web2py.js index 2e463733..257f87cd 100644 --- a/applications/examples/static/js/web2py.js +++ b/applications/examples/static/js/web2py.js @@ -490,12 +490,12 @@ * and prevent clicking on it */ disableElement: function(el) { el.addClass('disabled'); - var method = el.is('button') ? 'html' : 'val'; + var method = el.is('input') ? 'val' : 'html'; //method = el.attr('name') ? 'html' : 'val'; var disable_with_message = (typeof w2p_ajax_disable_with_message != 'undefined') ? w2p_ajax_disable_with_message : "Working..."; /*store enabled state if not already disabled */ - if(el.data('w2p:enable-with') === undefined) { - el.data('w2p:enable-with', el[method]()); + if(el.data('w2p_enable_with') === undefined) { + el.data('w2p_enable_with', el[method]()); } /*if you don't want to see "working..." on buttons, replace the following * two lines with this one @@ -515,11 +515,11 @@ /* restore element to its original state which was disabled by 'disableElement' above*/ enableElement: function(el) { - var method = el.is('button') ? 'val' : 'html'; - if(el.data('w2p:enable-with') !== undefined) { + var method = el.is('input') ? 'val' : 'html'; + if(el.data('w2p_enable_with') !== undefined) { /* set to old enabled state */ - el[method](el.data('w2p:enable-with')); - el.removeData('w2p:enable-with'); + el[method](el.data('w2p_enable_with')); + el.removeData('w2p_enable_with'); } el.removeClass('disabled'); el.unbind('click.w2pDisable'); @@ -586,12 +586,14 @@ if(pre_call != undefined) { eval(pre_call); } - if(confirm_message != undefined) { - if(confirm_message == 'default') confirm_message = w2p_ajax_confirm_message || 'Are you sure you want to delete this object?'; - if(!web2py.confirm(confirm_message)) { - web2py.stopEverything(e); - return; - } + if(confirm_message) { + if(confirm_message == 'default') + confirm_message = w2p_ajax_confirm_message || + 'Are you sure you want to delete this object?'; + if(!web2py.confirm(confirm_message)) { + web2py.stopEverything(e); + return; + } } if(target == undefined) { if(method == 'GET') { @@ -634,7 +636,7 @@ }); }, /* Disables form elements: - - Caches element value in 'w2p:enable-with' data store + - Caches element value in 'w2p_enable_with' data store - Replaces element text with value of 'data-disable-with' attribute - Sets disabled property to true */ @@ -646,8 +648,8 @@ if(disable_with == undefined) { element.data('w2p_disable_with', element[method]()) } - if(element.data('w2p:enable-with') === undefined) { - element.data('w2p:enable-with', element[method]()); + if(element.data('w2p_enable_with') === undefined) { + element.data('w2p_enable_with', element[method]()); } element[method](element.data('w2p_disable_with')); element.prop('disabled', true); @@ -655,16 +657,16 @@ }, /* Re-enables disabled form elements: - - Replaces element text with cached value from 'w2p:enable-with' data store (created in `disableFormElements`) + - Replaces element text with cached value from 'w2p_enable_with' data store (created in `disableFormElements`) - Sets disabled property to false */ enableFormElements: function(form) { form.find(web2py.enableSelector).each(function() { var element = $(this), method = element.is('button') ? 'html' : 'val'; - if(element.data('w2p:enable-with')) { - element[method](element.data('w2p:enable-with')); - element.removeData('w2p:enable-with'); + if(element.data('w2p_enable_with')) { + element[method](element.data('w2p_enable_with')); + element.removeData('w2p_enable_with'); } element.prop('disabled', false); }); @@ -730,4 +732,4 @@ web2py_event_handlers = jQuery.web2py.event_handlers; web2py_trap_link = jQuery.web2py.trap_link; web2py_calc_entropy = jQuery.web2py.calc_entropy; */ -/* compatibility code - end*/ \ No newline at end of file +/* compatibility code - end*/ diff --git a/applications/welcome/static/js/web2py.js b/applications/welcome/static/js/web2py.js index cd654b82..257f87cd 100644 --- a/applications/welcome/static/js/web2py.js +++ b/applications/welcome/static/js/web2py.js @@ -586,12 +586,14 @@ if(pre_call != undefined) { eval(pre_call); } - if(confirm_message != undefined) { - if(confirm_message == 'default') confirm_message = w2p_ajax_confirm_message || 'Are you sure you want to delete this object?'; - if(!web2py.confirm(confirm_message)) { - web2py.stopEverything(e); - return; - } + if(confirm_message) { + if(confirm_message == 'default') + confirm_message = w2p_ajax_confirm_message || + 'Are you sure you want to delete this object?'; + if(!web2py.confirm(confirm_message)) { + web2py.stopEverything(e); + return; + } } if(target == undefined) { if(method == 'GET') {