Concatenate user and hidden input in form to append URL


Concatenate user and hidden input in form to append URL



I’m using onsubmit to concatenate an input search value with a hidden set value in a form using get method as a workaround to hide certain products from search in shopify .


<form action="/search" method="get" role="search" onsubmit="q.value = search.value +' '+ myset.value";>






{% include 'icon-search' %}
{{ 'general.search.submit' | t }}


</div>





It works but results in a messy URL because I end up with a URL that has all the input data plus the concatenated output.



Basically all I need to do is append my set value to the end of the search query eg.
http://www.example.com/search?q=usersearchvalue+mysetvalue



But is there a neater way to achieve this result?



TIA





your code where is it ?
– Muhammad Omer Aslam
2 days ago





Apologies! Added ☝🏻
– mwalker
2 days ago









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Possible Unhandled Promise Rejection (id: 0): ReferenceError: user is not defined ReferenceError: user is not defined

Opening a url is failing in Swift