Forums › Forums › Search & Filter Pro › Autocapitalize, autocorrect and autocomplete for search inputs
- This topic has 8 replies, 2 voices, and was last updated 4 years, 2 months ago by Ross.
-
Anonymous(Private) August 12, 2020 at 2:56 pm #255811
Hello,
I want to remove the iOS keyboard suggestions, which essentially can be achieved by adding the following properties on an input tag:<input type=”search” autocapitalize=”off” autocomplete=”off” autocorrect=”off”>
Is there a way to do this in the search fields of SF?
Ross Moderator(Private) August 12, 2020 at 3:07 pm #255812Hi Nick, you can edit the attributes of our inputs by using the following filter:
https://searchandfilter.com/documentation/action-filter-reference/#filter-input-objectIf you check the github example you can see how to access the attributes.
Thanks
PS, we’ve just finished implementing these on our input fields in the upcoming S&F v3 ๐
Ross Moderator(Private) August 14, 2020 at 12:06 pm #256088Hi Nick
Yeah some of those are already being added to v3 ๐
Best
Anonymous(Private) August 14, 2020 at 3:58 pm #256118Hello,
I read the example and the gist, but still haven’t been able to find how to use this filter – it would be a great idea if you added a simple example on the website.
How can you retrieve the input object name of a search field so that you can use this filter?
Anonymous(Private) August 14, 2020 at 4:14 pm #256122Found it by investigating the inspector, but I think the name of each field should be more clearly visible.
Here is my working function:
function top_search_additional_attributes($input_object, $sfid) { if($input_object['name']=='_sf_search' && $sfid==161) { $input_object['attributes']['autocomplete'] = 'off'; $input_object['attributes']['autocapitalize'] = 'off'; $input_object['attributes']['autocorrect'] = 'off'; $input_object['attributes']['spellcheck'] = 'false'; echo $sfid; } return $input_object; } add_filter('sf_input_object_pre', 'top_search_additional_attributes', 10, 2);
Ross Moderator(Private) August 18, 2020 at 12:50 pm #256428Hi Nick
Thanks for the feedback, totally agree with you there.
We will make it either, editable, or visible in the admin UI in v3.
Best
-
AuthorPosts