Added the option to use advance field modeling to store data in other tables in combination with the field being set to not be stored in the view/table in the admin view. Fixed gh-487 yet once again to allow the datalength to be stored everytime, and not get dropped. Imporved the JCB way of conditions field behavior.

This commit is contained in:
2020-02-27 23:05:28 +02:00
parent a2db06fb43
commit aae9ffb6e0
82 changed files with 598 additions and 394 deletions

View File

@ -283,31 +283,46 @@ function vvvvwep(target_vvvvwep)
}
}
// update required fields
function updateFieldRequired(name,status)
{
var not_required = jQuery('#jform_not_required').val();
// update fields required
function updateFieldRequired(name, status) {
// check if not_required exist
if (jQuery('#jform_not_required').length > 0) {
var not_required = jQuery('#jform_not_required').val().split(",");
if(status == 1)
{
if (isSet(not_required) && not_required != 0)
if(status == 1)
{
not_required = not_required+','+name;
not_required.push(name);
}
else
{
not_required = ','+name;
not_required = removeFieldFromNotRequired(not_required, name);
}
}
else
{
if (isSet(not_required) && not_required != 0)
{
not_required = not_required.replace(','+name,'');
}
}
jQuery('#jform_not_required').val(not_required);
jQuery('#jform_not_required').val(fixNotRequiredArray(not_required).toString());
}
}
// remove field from not_required
function removeFieldFromNotRequired(array, what) {
return array.filter(function(element){
return element !== what;
});
}
// fix not required array
function fixNotRequiredArray(array) {
var seen = {};
return removeEmptyFromNotRequiredArray(array).filter(function(item) {
return seen.hasOwnProperty(item) ? false : (seen[item] = true);
});
}
// remove empty from not_required array
function removeEmptyFromNotRequiredArray(array) {
return array.filter(function (el) {
// remove ( 一_一) as well - lol
return (el.length > 0 && '一_一' !== el);
});
}
// the isSet function