fixed show_if with LOAD, thanks Niphlod
This commit is contained in:
1 parent
0fdab02d68
commit
ea3aa62476
4 files changed
+49
-49
No files matched your search
@@ -1 +1 @@
|
|||||||
Version 2.4.7-stable+timestamp.2013.06.04.09.30.34
|
Version 2.4.7-stable+timestamp.2013.06.04.16.40.00
|
||||||
@@ -35,6 +35,7 @@ function web2py_ajax_init(target) {
|
|||||||
jQuery('.hidden', target).hide();
|
jQuery('.hidden', target).hide();
|
||||||
jQuery('.error', target).hide().slideDown('slow');
|
jQuery('.error', target).hide().slideDown('slow');
|
||||||
web2py_ajax_fields(target);
|
web2py_ajax_fields(target);
|
||||||
|
web2py_show_if(target);
|
||||||
};
|
};
|
||||||
|
|
||||||
function web2py_event_handlers() {
|
function web2py_event_handlers() {
|
||||||
@@ -78,7 +79,6 @@ jQuery(function() {
|
|||||||
if(flash.html()) flash.append('<span id="closeflash">×</span>').slideDown();
|
if(flash.html()) flash.append('<span id="closeflash">×</span>').slideDown();
|
||||||
web2py_ajax_init(document);
|
web2py_ajax_init(document);
|
||||||
web2py_event_handlers();
|
web2py_event_handlers();
|
||||||
web2py_show_if();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function web2py_trap_form(action,target) {
|
function web2py_trap_form(action,target) {
|
||||||
@@ -217,26 +217,26 @@ function web2py_validate_entropy(myfield, req_entropy) {
|
|||||||
if(!myfield.hasClass('entropy_check')) myfield.on('keyup', validator).on('keydown', validator).addClass('entropy_check');
|
if(!myfield.hasClass('entropy_check')) myfield.on('keyup', validator).on('keydown', validator).addClass('entropy_check');
|
||||||
}
|
}
|
||||||
|
|
||||||
function web2py_show_if() {
|
function web2py_show_if(target) {
|
||||||
var triggers = {};
|
var triggers = {};
|
||||||
var show_if = function() {
|
var show_if = function () {
|
||||||
var t = jQuery(this);
|
var t = jQuery(this);
|
||||||
var id = t.attr('id');
|
var id = t.attr('id');
|
||||||
t.attr('value',t.val());
|
t.attr('value', t.val());
|
||||||
for(var k=0; k<triggers[id].length; k++) {
|
for(var k = 0; k < triggers[id].length; k++) {
|
||||||
var dep = jQuery('#'+triggers[id][k]);
|
var dep = jQuery('#' + triggers[id][k], target);
|
||||||
var tr = jQuery('#'+triggers[id][k]+'__row');
|
var tr = jQuery('#' + triggers[id][k] + '__row', target);
|
||||||
if(t.is(dep.attr('data-show-if'))) tr.slideDown();
|
if(t.is(dep.attr('data-show-if'))) tr.slideDown();
|
||||||
else tr.hide();
|
else tr.hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
jQuery('[data-show-trigger]').each(function(){
|
jQuery('[data-show-trigger]', target).each(function () {
|
||||||
var name = jQuery(this).attr('data-show-trigger');
|
var name = jQuery(this).attr('data-show-trigger');
|
||||||
if(!triggers[name]) triggers[name] = [];
|
if(!triggers[name]) triggers[name] = [];
|
||||||
triggers[name].push(jQuery(this).attr('id'));
|
triggers[name].push(jQuery(this).attr('id'));
|
||||||
});
|
});
|
||||||
for(var name in triggers) {
|
for(var name in triggers) {
|
||||||
jQuery('#'+name).change(show_if).keyup(show_if);
|
jQuery('#' + name, target).change(show_if).keyup(show_if);
|
||||||
show_if.call(jQuery('#'+name));
|
show_if.call(jQuery('#' + name, target));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -35,6 +35,7 @@ function web2py_ajax_init(target) {
|
|||||||
jQuery('.hidden', target).hide();
|
jQuery('.hidden', target).hide();
|
||||||
jQuery('.error', target).hide().slideDown('slow');
|
jQuery('.error', target).hide().slideDown('slow');
|
||||||
web2py_ajax_fields(target);
|
web2py_ajax_fields(target);
|
||||||
|
web2py_show_if(target);
|
||||||
};
|
};
|
||||||
|
|
||||||
function web2py_event_handlers() {
|
function web2py_event_handlers() {
|
||||||
@@ -78,7 +79,6 @@ jQuery(function() {
|
|||||||
if(flash.html()) flash.append('<span id="closeflash">×</span>').slideDown();
|
if(flash.html()) flash.append('<span id="closeflash">×</span>').slideDown();
|
||||||
web2py_ajax_init(document);
|
web2py_ajax_init(document);
|
||||||
web2py_event_handlers();
|
web2py_event_handlers();
|
||||||
web2py_show_if();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function web2py_trap_form(action,target) {
|
function web2py_trap_form(action,target) {
|
||||||
@@ -217,26 +217,26 @@ function web2py_validate_entropy(myfield, req_entropy) {
|
|||||||
if(!myfield.hasClass('entropy_check')) myfield.on('keyup', validator).on('keydown', validator).addClass('entropy_check');
|
if(!myfield.hasClass('entropy_check')) myfield.on('keyup', validator).on('keydown', validator).addClass('entropy_check');
|
||||||
}
|
}
|
||||||
|
|
||||||
function web2py_show_if() {
|
function web2py_show_if(target) {
|
||||||
var triggers = {};
|
var triggers = {};
|
||||||
var show_if = function() {
|
var show_if = function () {
|
||||||
var t = jQuery(this);
|
var t = jQuery(this);
|
||||||
var id = t.attr('id');
|
var id = t.attr('id');
|
||||||
t.attr('value',t.val());
|
t.attr('value', t.val());
|
||||||
for(var k=0; k<triggers[id].length; k++) {
|
for(var k = 0; k < triggers[id].length; k++) {
|
||||||
var dep = jQuery('#'+triggers[id][k]);
|
var dep = jQuery('#' + triggers[id][k], target);
|
||||||
var tr = jQuery('#'+triggers[id][k]+'__row');
|
var tr = jQuery('#' + triggers[id][k] + '__row', target);
|
||||||
if(t.is(dep.attr('data-show-if'))) tr.slideDown();
|
if(t.is(dep.attr('data-show-if'))) tr.slideDown();
|
||||||
else tr.hide();
|
else tr.hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
jQuery('[data-show-trigger]').each(function(){
|
jQuery('[data-show-trigger]', target).each(function () {
|
||||||
var name = jQuery(this).attr('data-show-trigger');
|
var name = jQuery(this).attr('data-show-trigger');
|
||||||
if(!triggers[name]) triggers[name] = [];
|
if(!triggers[name]) triggers[name] = [];
|
||||||
triggers[name].push(jQuery(this).attr('id'));
|
triggers[name].push(jQuery(this).attr('id'));
|
||||||
});
|
});
|
||||||
for(var name in triggers) {
|
for(var name in triggers) {
|
||||||
jQuery('#'+name).change(show_if).keyup(show_if);
|
jQuery('#' + name, target).change(show_if).keyup(show_if);
|
||||||
show_if.call(jQuery('#'+name));
|
show_if.call(jQuery('#' + name, target));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -35,6 +35,7 @@ function web2py_ajax_init(target) {
|
|||||||
jQuery('.hidden', target).hide();
|
jQuery('.hidden', target).hide();
|
||||||
jQuery('.error', target).hide().slideDown('slow');
|
jQuery('.error', target).hide().slideDown('slow');
|
||||||
web2py_ajax_fields(target);
|
web2py_ajax_fields(target);
|
||||||
|
web2py_show_if(target);
|
||||||
};
|
};
|
||||||
|
|
||||||
function web2py_event_handlers() {
|
function web2py_event_handlers() {
|
||||||
@@ -78,7 +79,6 @@ jQuery(function() {
|
|||||||
if(flash.html()) flash.append('<span id="closeflash">×</span>').slideDown();
|
if(flash.html()) flash.append('<span id="closeflash">×</span>').slideDown();
|
||||||
web2py_ajax_init(document);
|
web2py_ajax_init(document);
|
||||||
web2py_event_handlers();
|
web2py_event_handlers();
|
||||||
web2py_show_if();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function web2py_trap_form(action,target) {
|
function web2py_trap_form(action,target) {
|
||||||
@@ -217,26 +217,26 @@ function web2py_validate_entropy(myfield, req_entropy) {
|
|||||||
if(!myfield.hasClass('entropy_check')) myfield.on('keyup', validator).on('keydown', validator).addClass('entropy_check');
|
if(!myfield.hasClass('entropy_check')) myfield.on('keyup', validator).on('keydown', validator).addClass('entropy_check');
|
||||||
}
|
}
|
||||||
|
|
||||||
function web2py_show_if() {
|
function web2py_show_if(target) {
|
||||||
var triggers = {};
|
var triggers = {};
|
||||||
var show_if = function() {
|
var show_if = function () {
|
||||||
var t = jQuery(this);
|
var t = jQuery(this);
|
||||||
var id = t.attr('id');
|
var id = t.attr('id');
|
||||||
t.attr('value',t.val());
|
t.attr('value', t.val());
|
||||||
for(var k=0; k<triggers[id].length; k++) {
|
for(var k = 0; k < triggers[id].length; k++) {
|
||||||
var dep = jQuery('#'+triggers[id][k]);
|
var dep = jQuery('#' + triggers[id][k], target);
|
||||||
var tr = jQuery('#'+triggers[id][k]+'__row');
|
var tr = jQuery('#' + triggers[id][k] + '__row', target);
|
||||||
if(t.is(dep.attr('data-show-if'))) tr.slideDown();
|
if(t.is(dep.attr('data-show-if'))) tr.slideDown();
|
||||||
else tr.hide();
|
else tr.hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
jQuery('[data-show-trigger]').each(function(){
|
jQuery('[data-show-trigger]', target).each(function () {
|
||||||
var name = jQuery(this).attr('data-show-trigger');
|
var name = jQuery(this).attr('data-show-trigger');
|
||||||
if(!triggers[name]) triggers[name] = [];
|
if(!triggers[name]) triggers[name] = [];
|
||||||
triggers[name].push(jQuery(this).attr('id'));
|
triggers[name].push(jQuery(this).attr('id'));
|
||||||
});
|
});
|
||||||
for(var name in triggers) {
|
for(var name in triggers) {
|
||||||
jQuery('#'+name).change(show_if).keyup(show_if);
|
jQuery('#' + name, target).change(show_if).keyup(show_if);
|
||||||
show_if.call(jQuery('#'+name));
|
show_if.call(jQuery('#' + name, target));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user