src/main/webapp/js/singlepage-form.js
// Finally update the preview display with the new value
Finally update the preview display with the new value
Finally update the preview display with the new value
function updateFilterField($filterfield) {
		function removeFromFilterList(filterName) {
			activeFilters = $.grep(activeFilters, function(elem) { return elem.name === filterName;}, true);
		}
		var filterName = $filterfield.attr('id');
		var filterType = $filterfield.data('filterfield-type');
		var $inputs = $filterfield.find('input, select');
		var values = [];
		if (filterType === 'range') {
			var from = $($inputs[0]).val();
			var to = $($inputs[1]).val();
			if (from && to) 
				values.push(from, to);
		} else {
			var firstVal = $inputs.first().val();
			if (firstVal != null && firstVal != '')
				values = values.concat(firstVal);
		}
		removeFromFilterList(filterName);
		if (values.length >= 1) {
			activeFilters.push({
				name: filterName,
				filterType: filterType,
				values: values
			});
		}
		updateFilterDisplay();
	}
function updateFilterField ( $filterfield ) { function removeFromFilterList ( filterName ) { activeFilters = $ . grep ( activeFilters , function ( elem ) { return elem . name === filterName ; } , true ) ; } var filterName = $filterfield . attr ( 'id' ) ; var filterType = $filterfield . data ( 'filterfield-type' ) ; var $inputs = $filterfield . find ( 'input, select' ) ; var values = [ ] ; if ( filterType === 'range' ) { var from = $ ( $inputs [ 0 ] ) . val ( ) ; var to = $ ( $inputs [ 1 ] ) . val ( ) ; if ( from && to ) values . push ( from , to ) ; } else { var firstVal = $inputs . first ( ) . val ( ) ; if ( firstVal != null && firstVal != '' ) values = values . concat ( firstVal ) ; } removeFromFilterList ( filterName ) ; if ( values . length >= 1 ) { activeFilters . push ( { name : filterName , filterType : filterType , values : values } ) ; } updateFilterDisplay ( ) ; }
Finally update the preview display with the new value
Finally update the preview display with the new value
// Has two input fields, special treatment // Since these are text inputs, any falsy value ('', undefined, null) is invalid // We always store values in an array because multiselect and date fields both have multiple values // Concatenate values since firstVal might be an array itself // val might be an array (in case of multiselect), so concatenate to deal with single values as well as arrays