I'm know how to navigate code, and once I learn how to code something I remember it forever. That being said I have never built a search form before with this functionality and I was wondering if someone here could lead me in the right direction with how to get started.
User chooses at least one option for any field. So he could choose to search for just Option 1 and not use option 2 / 3. Or he can select Option 1 , 2 and 3.
(brackets indicate an option the user choose)
Option 1 Dropdown
- [test]
- test2
- test3
Option 2 Dropdown
- test
- [test2]
- test3
Option 3 Dropdown
- test
- test2
- [test3]
Option 4 Dropdown
- test
- test2
- test3
user hits submit button and the following page loads:
In trying to google for answer, I keep searching 'build web form' and everything coming back thus far is about building comment forms, or email collection forms. That's not entirely what I'm doing here. If someone can give me a phrase of what I'm trying to do that would help me find a better google result that would be appreciated too :)
If I'm not over simplifying what you're trying to do, I believe you are looking to pass the search criteria via Query Strings in the URL. If that's what you're after, you'll just have to create a separate file or section within the page that does the processing and have that as your action on the form submission.
I'm know how to navigate code, and once I learn how to code something I remember it forever. That being said I have never built a search form before with this functionality and I was wondering if someone here could lead me in the right direction with how to get started.
User chooses at least one option for any field. So he could choose to search for just Option 1 and not use option 2 / 3. Or he can select Option 1 , 2 and 3.
(brackets indicate an option the user choose)
Option 1 Dropdown - [test] - test2 - test3
Option 2 Dropdown - test - [test2] - test3
Option 3 Dropdown - test - test2 - [test3]
Option 4 Dropdown - test - test2 - test3
user hits submit button and the following page loads:
yoursite.com/?option1=test&option2=test2&option3=test3
The user didn't select anything for option 4 , thus it doesn't appear in the url.
In trying to google for answer, I keep searching 'build web form' and everything coming back thus far is about building comment forms, or email collection forms. That's not entirely what I'm doing here. If someone can give me a phrase of what I'm trying to do that would help me find a better google result that would be appreciated too :)
My test codepen
If I'm not over simplifying what you're trying to do, I believe you are looking to pass the search criteria via Query Strings in the URL. If that's what you're after, you'll just have to create a separate file or section within the page that does the processing and have that as your action on the form submission.
I found some code to do what I want :D
function misMakeUrl() { var url='http://yoururl.com/'; var comma='?'; if(document.myWebForm.Option1.value!="") { url+=comma+"Option1="+document.myWebForm.Option1.value; comma='&'; } if(document.myWebForm.Option2.value!="") { url+=comma+"Option2="+document.myWebForm.Option2.value; comma='&'; } if(document.myWebForm.Option3.value!="") { url+=comma+"Option3="+document.myWebForm.Option3.value; comma='&'; } if(document.myWebForm.Option4.value!="") { url+=comma+"Option4="+document.myWebForm.Option4.value; comma='&'; } if(document.myWebForm.list_sqfeet.value!="") { url+=comma+"list_sqfeet="+document.myWebForm.list_sqfeet.value; comma='&'; } if(document.myWebForm.list_price.value!="") { url+=comma+"list_price="+document.myWebForm.list_price.value; comma='&'; } document.location.href=url; return false; }