texaschick Posted June 5, 2001 Posted June 5, 2001 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.
dspires Posted June 6, 2001 Posted June 6, 2001 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.
proton Posted June 6, 2001 Posted June 6, 2001 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.
dspires Posted June 6, 2001 Posted June 6, 2001 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>
texaschick Posted June 6, 2001 Author Posted June 6, 2001 dspires, Thanks so much. That is exactly what I was looking for.
Recommended Posts
This topic is 8640 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now