|
| |
|
|
meridian
Posts: 78 Joined: 11/26/2003 Status: offline
|
using radio buttons to determine fields to be searched - 4/10/2008 21:57:55
I have a database with a number of fields including two that I would like to have searchable by the user......Posting_Position and Posting_State. I would like to have a text field where the user can input their criteria and then select one of two radio buttons to determine if the Posting_Position field or Posting_State field should be searched upon clicking submit. The results will be displayed on a separate page. The radio button group name is "searchby" The following is the what I have tried but an error is returned when the search is performed. <form method="POST" action="indexsearch.asp">
<p style="margin-top: 0; margin-bottom: 0">
<input type="radio" value="Posting_Position" name="searchby"><SPAN class="link2">Position
</span>
<input type="radio" name="searchby" value="Posting_State"><SPAN class="link2">State
</span>
</p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="text" name="jobsearch" size="20"></p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
fp_sQry="SELECT * FROM Results WHERE ::searchby:: LIKE '%::jobsearch::%'"
fp_sDefault="searchby=&jobsearch="
fp_sNoRecords="<tr><td colspan=43 align=left width=""100%"">No records returned.</td></tr>"
fp_sDataConn="employercontactpost"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice="ID"
fp_sMenuValue="ID"
fp_sColTypes="&ID=3&Posting_Position=202&Posting_Company=202&Posting_City=202&Posting_State=202&Posting_Website=202&Upload=202&Posting_Description=203&Posting_Contact_Person=202&Posting_email=202&Posting_Phone=202&Posting_Fax=202&Contact_Company=202&Contact_Name_First=202&Contact_email=202&Contact_Name_Last=202&Contact_Position_Title=202&Contact_Phone=202&Contact_Phone_Ext=202&Billing_Address_Street=202&Billing_City=202&Billing_Province_State=202&Billing_Postal_Zip_Code=202&Billing_Country=202&Billing_PO_Number=202&Posting_Type=202&Contact_Company1=202&Contact_Name_First1=202&Contact_email1=202&Contact_Name_Last1=202&Contact_Position_Title1=202&Contact_Phone1=202&Contact_Phone_Ext1=202&Billing_Address_Street1=202&Billing_City1=202&Billing_Province_State1=202&Billing_Postal_Zip_Code1=202&Billing_PO_Number1=202&Posting_Type1=202&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&"
fp_iDisplayCols=43
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: using radio buttons to determine fields to be searched - 4/12/2008 12:17:20
quote:
The following is the what I have tried but an error is returned when the search is performed. Can you post the specific error? quote:
fp_sDefault="searchby=&jobsearch=" Also, you might need to put a default in there if it is erroring on first entry. IOW if it error without doing a search at all. fp_sDefault="searchby=Posting_Position&jobsearch=" Maybe?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
meridian
Posts: 78 Joined: 11/26/2003 Status: offline
|
RE: using radio buttons to determine fields to be searched - 4/12/2008 13:03:40
Thanks RD for the reply, The error returned is: Database Results Error The operation failed. If this continues, please contact your server administrator. I have tried putting the default as recomended but I come up with the same error
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: using radio buttons to determine fields to be searched - 4/12/2008 13:10:23
Yeah, those generic errors don't help very much. Can you refer to this post: http://www.frontpagewebmaster.com/m-175524/tm.htm and see if you can get a more descriptive error message?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
meridian
Posts: 78 Joined: 11/26/2003 Status: offline
|
RE: using radio buttons to determine fields to be searched - 4/12/2008 13:15:44
The error is now: Database Results Error Unable to find operator in query string. Query string currently is SELECT * FROM Results WHERE ::searchby:: LIKE '%::jobsearch::%'
|
|
|
|
DesiMcK
Posts: 446 Joined: 4/26/2004 From: Essex, UK Status: offline
|
RE: using radio buttons to determine fields to be searched - 4/12/2008 13:24:54
You could try: "SELECT * FROM Results WHERE " & Request("searchby") LIKE '" & Request("jobsearch") & "%'" I also assume you have two fields in your db that are called Posting_Position and Posting_State. Desi
|
|
|
|
meridian
Posts: 78 Joined: 11/26/2003 Status: offline
|
RE: using radio buttons to determine fields to be searched - 4/12/2008 13:55:01
Yes, there are two fields in the database with those names. The error I receive now is: Microsoft VBScript compilation error '800a03ea' Syntax error /indexsearch.asp, line 31 fp_sQry="SELECT * FROM Results WHERE " & Request("searchby") LIKE '" & Request("jobsearch") & "%'"
|
|
|
|
DesiMcK
Posts: 446 Joined: 4/26/2004 From: Essex, UK Status: offline
|
RE: using radio buttons to determine fields to be searched - 4/12/2008 14:35:22
Sorry my fault - left out an & try: fp_sQry="SELECT * FROM Results WHERE " & Request("searchby") & "LIKE '%" & Request("jobsearch") & "%'"
|
|
|
|
meridian
Posts: 78 Joined: 11/26/2003 Status: offline
|
RE: using radio buttons to determine fields to be searched - 4/12/2008 14:49:49
New error: Database Results Error Description: Syntax error (missing operator) in query expression 'Posting_PositionLIKE '%customer%''. Number: -2147217900 (0x80040E14) Source: Microsoft JET Database Engine
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: using radio buttons to determine fields to be searched - 4/12/2008 15:16:50
& "LIKE '% Missing a space between the first double quote and the L ...& " LIKE '%... That any better?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
meridian
Posts: 78 Joined: 11/26/2003 Status: offline
|
RE: using radio buttons to determine fields to be searched - 4/12/2008 15:29:05
My statement looks like <%
fp_sQry="SELECT * FROM Results WHERE " & Request("searchby") & "LIKE'%" & Request("jobsearch") & "%'"
fp_sDefault="searchby=Posting_Position&jobsearch="
fp_sNoRecords="<tr><td colspan=43 align=left width=""100%"">No records returned.</td></tr>"
fp_sDataConn="employercontactpost"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice="ID"
And is still receiving the error: Database Results Error Description: Syntax error (missing operator) in query expression 'Posting_PositionLIKE'%customer%''. Number: -2147217900 (0x80040E14) Source: Microsoft JET Database Engine
|
|
|
|
meridian
Posts: 78 Joined: 11/26/2003 Status: offline
|
RE: using radio buttons to determine fields to be searched - 4/12/2008 15:59:40
Working great! Thank-you all again
|
|
|
|
DesiMcK
Posts: 446 Joined: 4/26/2004 From: Essex, UK Status: offline
|
RE: using radio buttons to determine fields to be searched - 4/12/2008 16:25:59
Great stuff - sorry I had a few errors in my original offering. Desi
|
|
|
|
meridian
Posts: 78 Joined: 11/26/2003 Status: offline
|
RE: using radio buttons to determine fields to be searched - 4/12/2008 16:56:13
Thanks Desi, just grateful for all the help...........now were off to watch Tiger
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|