Attempting to make a cool Search bar.. (please help) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

Attempting to make a cool Search bar.. (please help)

I was making a code with different searches from websites, but I thought I could make one search bar and many Submit Search Buttons (1 submit button for each website with search https://code.sololearn.com/WjeQsUNg3i22/?ref=app

25th Jun 2020, 1:28 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar
13 Answers
+ 7
Ok so what is the question? Do you need help with the design? Or with the implementation?
25th Jun 2020, 1:43 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 6
25th Jun 2020, 1:28 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar
+ 6
Sandra Meyer I still don’t get it
25th Jun 2020, 2:42 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar
+ 5
🔥 Alex Tușinean 🐺 I want help with the code because earlier I used this: <form action="https://search.yahoo.com/search" target="_blank" > <input class="myInput"placeholder="Search" type="search"name="p"> <button class="button" type="search"value="submit">Search</button> Now I want that somehow there is only one search field but one submit serach button for each search engine
25th Jun 2020, 1:48 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar
+ 5
Sandra Meyer How should I do that? Can you please show me an example based on https://code.sololearn.com/WjeQsUNg3i22/?ref=app THank you so much
25th Jun 2020, 1:51 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar
+ 5
Sandra Meyer the problem is that the form action attribute does not work. Is there a way that the form action attribute and the input name attribute changes based on what submit button you press?
25th Jun 2020, 2:09 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar
+ 5
Sandra Meyer ok thanks
25th Jun 2020, 3:33 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar
25th Jun 2020, 2:07 PM
Sandra Meyer
Sandra Meyer - avatar
+ 3
You'll need the formaction-attribute for the multiple buttons. Use it similar to action of form.
25th Jun 2020, 1:46 PM
Sandra Meyer
Sandra Meyer - avatar
+ 3
You can modify the names of query parameters for each button individually. Use name="queryParam" for each button.
25th Jun 2020, 2:17 PM
Sandra Meyer
Sandra Meyer - avatar
+ 3
See modified code. I added some working links and set a default query param and a user defined one.
25th Jun 2020, 2:22 PM
Sandra Meyer
Sandra Meyer - avatar
+ 3
Oh you want to execute some additional code? Then you just have to wrap it around. Otherwise you don't need the form action attribute.
25th Jun 2020, 2:25 PM
Sandra Meyer
Sandra Meyer - avatar
+ 3
If you want to change the form dynamically you'll have to code it. Butt what exactly do you want to change? Why do you want to use the form action attribute? Why not the button's one?
25th Jun 2020, 3:31 PM
Sandra Meyer
Sandra Meyer - avatar