Connecting Tech Pros Worldwide Help | Site Map

Errors in cfsearch with Verity code taken from Adobe site docs

Member
 
Join Date: Mar 2008
Location: INDIA
Posts: 50
#1: Jun 5 '08
cf search using verity for my web site. I actually took the code from docs on teh web and tweeked a couple things out on it. Now it is throwing errors and I can't figure out why. What is funny is what is throwing errors was taken strait from the adobe web site docs., so here is my code, I will show you the code I use to index the verity collection, and then the result page.

Indexing code:
Expand|Select|Wrap|Line Numbers
  1. <cfflush>
  2.  
  3. <cfquery name="getresults" dataSource="#APPLICATION.dataSource#">
  4. SELECT Content.Body, Content.title, Content.page, Content.ContentID
  5. FROM Content
  6. </cfquery>
  7.  
  8.  
  9. <span class="style1"> Indexing data ...</span><br>
  10. <cfflush>
  11.  
  12. <cfindex action="refresh"
  13. collection="pdsSite"
  14. key="ContentID"
  15. type="custom"
  16. title="title"
  17. query="getresults"
  18. body="title,Body,page">
  19.  
  20. Result page:
  21.  
  22. <cfsearch name="GetResults"
  23. collection="pdsSite"
  24. criteria="#FORM.criteria#">
  25. <head>
  26. </head>
  27. <body>
  28. <cfform action="result.cfm" method="post">
  29.  
  30. <cfinput type="text" name="criteria" value="#FORM.criteria#" message="Please enter your key word to search." validateat="onSubmit" validate="noblanks" required="yes" id="criteria" size="30" class="main_Inputs">
  31.  
  32. <cfinput type="submit" value="Search">
  33. </cfform>
  34.  
  35. <cfoutput>
  36. Search Results:#FORM.criteria#
  37. </cfoutput>
  38.  
  39. <cfif GetResults.RecordCount is 0>
  40. No files found for specified search, please try a new search.
  41. <cfelse>
  42. <cfoutput query="GetResults">
  43. <cfset bgcolor=IIf(CurrentRow Mod 2,
  44. DE('ffffff'),
  45. DE('ffffcf'))>
  46. #CurrentRow#
  47. <cfset FileName=GetFileFromPath(Key)>
  48. <cfset Ext=ListLast(FileName, ".")>
  49. <cfif Trim(Title) IS "">
  50. <cfset display=GetFileFromPath(Key)>
  51. <cfelse>
  52. <cfset display=title>
  53. </cfif>
  54. <a href="#page#" class="subNav">#display#</a> <span class="style8">(#score#)</span> <br>
  55. <span class="style8"><small>#body#</small></span>
  56. </cfoutput>
  57. </cfif>
  58.  
Now here is the first error. (there are a couple, but lets do them one at a time.)

Error message:

Attribute validation error for tag CFINPUT.
The tag requires the attribute(s): NAME.

The error occurred in C:\Websites\result.cfm: line 81

Expand|Select|Wrap|Line Numbers
  1. 79 : <td class="style8">Search:</td>
  2. 80 : <td><cfinput type="text" name="criteria" value="#FORM.criteria#" message="Please enter your key word to search." validateat="onSubmit" validate="noblanks" required="yes" id="criteria" size="30" class="main_Inputs"></td>
  3. 81 : <td><cfinput type="submit" value="Search"></td>
  4. 82 : </tr>
  5. 83 : </table>
  6.  
I do this kind of stuff all the tie with form fields, and now anything I do to fix it, it throws this error. What am I doing wrong here to place what you used for search critera on a search box in some other place on the site into this search box?

Error 2:
Then my next error is that page is not defined, that is where my link is set up for you to click on the record that gave you results. I can get that error after I fix the search critera error
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Jun 5 '08

re: Errors in cfsearch with Verity code taken from Adobe site docs


The error is pretty self-explanatory. Just add a name attribute to the cfinput submit button.
Member
 
Join Date: Mar 2008
Location: INDIA
Posts: 50
#3: Jun 7 '08

re: Errors in cfsearch with Verity code taken from Adobe site docs


oHHHHHHHHHHHH Thanks a lot
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: Jun 7 '08

re: Errors in cfsearch with Verity code taken from Adobe site docs


You're welcome :)
Reply


Similar ColdFusion bytes