June 5, 200124 yr I have looked around but I can't find the answer I am looking for. I want to have a person search several fields in my database but only enter one text string. I would like to have radio buttons saying for example "search answer only", "search question only", "search both q & a". Can anyone help me figure this out? Thanks.
June 6, 200124 yr The way that I do it is with javascript. Here is an example from a similar question that I gave. http://www.fmforums.com/ubb/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=45&t=000192 If you need the code for your page, post your form section.
June 6, 200124 yr quote: Originally posted by texaschick: I have looked around but I can't find the answer I am looking for. I want to have a person search several fields in my database but only enter one text string. I would like to have radio buttons saying for example "search answer only", "search question only", "search both q & a". Can anyone help me figure this out? Thanks. texaschick, I would create calculated fields in my database. These fields only purpose would be to combine the data from several different fields and display them. For example I could create a field called "Answer Calc", set it as calculation and define it as such:- Answer1&" "&Answer2&" "&Answer3 where "Answer1", "Answer2", "Answer3" are different fields in the database. I would set the result as text or whatever (depending on the data in the answer fields). Finally in the search page I would let them search this field. Hope this helps.
June 6, 200124 yr Here is the HTML page with the javascript to do what you want: <html> <head> <script> function setChoice(choice){ switch(choice){ case (0) document.yourForm.answer.value=""; document.yourForm.question.value=""; break; case (1) : document.yourForm.answer.value=document.yourForm.searchText.value; document.yourForm.question.value=""; break; case (2) : document.yourForm.answer.value=""; document.yourForm.question.value=document.yourForm.searchText.value; break; case (3) : document.yourForm.answer.value=document.yourForm.searchText.value; document.yourForm.question.value=document.yourForm.searchText.value; } } </script> </head> <body> <form name="yourForm"> Type your search criteria here: <input type="text" name="searchText" value="" size=20> and then <select NAME="choice" onChange="setChoice(this.selectedIndex)"> <option selected>--Select search option-- <option>search answer only <option>search question only <option>search both </select> <br> Answer: <input type="text" name="answer" value="" size=20> (this would be a hidden field) <br> Question: <input type="text" name="question" value="" size=20> (this would be a hidden field) <br> <INPUT TYPE="Reset" VALUE="Clear this form"> </form> </body> </html>
Create an account or sign in to comment