All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ph-oton.uicore-form.min.js Maven / Gradle / Ivy

The newest version!
function FormHelperClass(){}
FormHelperClass.prototype={patternProp:/\(\)$/,patternArray:/\[\]$/,getAllFormValues:function(b,c){var a={};b=$("#"+b).find("*");b.filter('input[type="checkbox"], input[type="radio"]').each(function(){a[c+this.name+"()"]=$(this).prop("checked")});b.filter('select[multiple="multiple"]').each(function(){a[c+this.name+"[]"]=$(this).val()});b.filter('input[type="text"], input[type="hidden"], select[multiple!="multiple"], textarea').each(function(){a[c+this.name]=$(this).val()});return a},setAllFormValues:function(b,
c){var a;for(a in c){var d=c[a];this.patternProp.test(a)?$("#"+b+' [name="'+a.substring(0,a.length-2)+'"]').prop("checked",d):this.patternArray.test(a)?$("#"+b+' [name="'+a.substring(0,a.length-2)+'"]').val(d):$("#"+b+' [name="'+a+'"]').val(d)}},updateElementDirect:function(b,c){$("#"+b).empty().append(c)},updateElementViaAjax:function(b,c){$.ajax({url:c,success:function(a){a.value&&FormHelper.updateElementDirect(b,a.value.html)}})},updateElements:function(b){for(var c in b){var a=b[c];a.url?FormHelper.updateElementViaAjax(a.id,
a.url):FormHelper.updateElementDirect(a.id,a.html)}},saveFormData:function(b,c,a,d,e,f){b=FormHelper.getAllFormValues(b,c);b.$pageID=a;$.ajax({url:d,data:b,success:function(g){FormHelper.updateElements(e)},error:function(g){FormHelper.updateElements(f)}})},setSelectOptions:function(b,c){b.empty();$.each(c,function(a,d){b.append($("").attr("value",d[0]).text(d[1]))})}};var FormHelper=window.FormHelper=new FormHelperClass;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy