- This topic has 3 replies, 2 voices, and was last updated 9 years, 4 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › default value
Tagged: dropdown
Using javascript, yes. I assume you only want to do this on initial load (when the form is otherwise empty or unfiltered. You can use the is_filtered function to test for that and then use javascript to set the value of the input. See this thread for the basic usage.
Hi,
Thanks ,
I’m not a developer with JavaScript, but I’ll try.
I have to test with.:
global $searchandfilter;
$sf_current_query = $searchandfilter->get(1726)->current_query();
if ($sf_current_query->is_filtered()) {
// do the loop
} else {
// initialize data with javascript
}
where do I insert the javascript?
for exemple to set a date with the today’s date (_sfm_my_date)
Thanks
Nor am I 🙁 I have done some, but not a lot. My guess, for you, you would need something more like:
global $searchandfilter;
$sf_current_query = $searchandfilter->get(1726)->current_query();
if (!$sf_current_query->is_filtered()) {
// put your javascript here
}