Hi there
I have created a search page but am missing 1 search criteria to be properly configured.
I have a number field called Date (which is just a year)
I would like users to be able to filter/search results via year range (instead to typing the year).
How can I achieve this?
See image attached for what I have and what I'd like to have.
Thanks
Hello,
In your case it needs a range filters, and it needs custom codes, see below test site:
Login URL:
hidden link
1) Create a view, filter by custom field "Date", option "Using this comparison" choose "Between", see my screenshot between1.jpg
So after user submit the search form, it will pass two URL parameters(StartDate and Enddate) to view
See the result page:
hidden link
2) Use custom CSS/JS codes to style above two fields to the slider filter, for example:
hidden link
Where exactly do i put the code?
and is this the code?
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Slider - Range slider</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="hidden link"></script>
<script src="hidden link"></script>
<script>
$( function() {
$( "#slider-range" ).slider({
range: true,
min: 0,
max: 500,
values: [ 75, 300 ],
slide: function( event, ui ) {
$( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
}
});
$( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) +
" - $" + $( "#slider-range" ).slider( "values", 1 ) );
} );
</script>
</head>
<body>
<p>
<label for="amount">Price range:</label>
<input type="text" id="amount" readonly style="border:0; color:#f6931f; font-weight:bold;">
</p>
<div id="slider-range"></div>
</body>
</html>