EasyCFM.COM ColdFusion Forums / Application Beta Testing Area! / Urgently need help on building search engine form

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Urgently need help on building search engine form

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

alexax
04-06-2009 @ 11:20 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 2
Joined: Apr 2009

Having input text problems.
I've created the search form, results form and frame form. When i input any alphabet or number onto the textbox and click search, the outcome is not what i expected instead it shows all the results from the database table. What i want is that when i type anything, be it an number or an alphbet that is same to the data of a fieldname in rows(i.e 350v221, 350v265cc, a135vod etc..) inside the textbox, it will show the results of that particular files only. My database table have fieldnames like, DOC_NO (containing data of [i.e 350v000, 350v2587, 350v226 etc..]) [IN ROWS] ), DESCRIBE, REMARKS and STATUS. Also i got some tables that have many data (in number of rows) that consist of more than 20,000 information. My database table's name are saved as the starting number/alphbet (ie. 335a.dbm, 335b.dbm, 335c.dbm, 360V.dbm, wei.dbm, ght.dbm etc...). So is there any simple ways to query for these data? I've created frames so as to show the resulting page on the right frame and the searching page on the left frame. How do i link it together so as the results will show only on right frame even it get refresh?



<b><!---Search_results.cfm---></b>

<CFset index="1">

<cfif not IsDefined("Form.txtNumberInput")> <!---If there's no input been type onto textbox, it will do the following code--->

    <cfquery name="get_FirstNo" datasource="DSN_db1_IWS">
     select *
     from 335v where doc_no like '%#form.txtNumberInput#%'
     order by doc_no
     </cfquery>

    <cfelseif IsDefined("form.txtNumberInput")>
    <cfquery name="get_FirstNo" datatsource="DSN_db1_IWS">
     select *
     from 335v where doc_no like '%#form.txtNumberInput#%'
     order by doc_no
     </cfquery>

     <cfquery name="get_total" datatsource="DSN_db1_IWS">
     select *
     from 335v where doc_no not in ('abc')
     </cfquery>
</cfif>

    <cfif not IsDefined("form.ddlnumber")>
    <cfquery name="get_FirstNo" datasource="DSN_db1_IWS">
     select *
     from 335v where doc_no like '%#A#%'
     order by doc_no
     </cfquery>

     <cfif IsDefined("form.ddlnumber")>
     <cfquery name="get_FirstNo" datasource="DSN_db1_IWS">
     select *
     from 335v where doc_no like 'b%'
     order by doc_no
     </cfquery>

    <cfquery name="get_total" datatsource="DSN_db1_IWS">
     select *
     from 335v
    </cfquery>

     <cfelseif #form.ddlnumber# is "Display Number">
     <cfquery name="get_FirstNo" datasource="DSN_db1_IWS">
     select *
     from 335v where doc_no like %#form.txtNumberInput#%
     order by doc_no
     </cfquery>

    <cfquery name="get_total" datatsource="DSN_db1_IWS">
     select *
     from 335v
    </cfquery>
    </cfif>

<body bgcolour="A7EF92">
<table width....>
<tr>
<th width......>Number of files Generated:</br>
<font....><cfoutput>#get_total.qty#</cfoutput>
</table><br>

<table>
<tr>
<td...><font....>S/N</font></td>
<td...><font....>DOC_NO</font></td>
</tr>

<cfoutput query="get_FirstNo">
<tr>
<td align=""....>
<cfScript>

        writeoutput(index);
        index=index+1;
</cfscript>
</td>
<td.....><a href="../drawing search/searching.cfm?Doc_no=#'txtNumberInput'#" target="rightBottomFrame">#get_FirstNo.doc_no#</a></font></td>

<td....><font..>#get_FirstNo.DESCRIBE#</font></td>
<td....><font..>#get_FirstNo.STATUS#</font></td>
<td....><font..>#get_FirstNo.REMARKS#</font></td>
</TR>
</cfoutput>
</table>
</body></html>

<b><!---searching.cfm</b>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Searching</title>
</head>

<body bgcolor....>
<cfif not IsDefined("Form.txtNumberInput")>
<cfquery name="get_FirstNo" datasource="DSN_db1_IWS">
     select *
     from 335v where doc_no like 'A%'
     order by doc_no
</cfquery>

<cfelseif IsDefined("Form.txtNumberInput")>
<cfquery name="get_FirstNo" datasource="DSN_db1_IWS">
     select *
     from 335v where doc_no like 'h%'
     order by doc_no
</cfquery>
</cfif>
<cfquery name="get_FirstNo" datasource="DSN_db1_IWS">
     select *
     from 335v
</cfquery>

<cfquery name="get_total" datatsource="DSN_db1_IWS">
     select count(*) as qty
     from 335v
     </cfquery>

<form action="search_results.cfm" method="post" target="rightBottomFrame">
<font>...
</font>
<input name="txtNumberInput" type="text" size="25">
<br>
</form></body></html>


      
Open in New Window Select All Accept and Award Points Accept as Solution

    
    Please take a moment to respond  
    Did this comment work for you?  Yes  Partially  No Was the comment complete?  Yes  Partially  No Was the comment easy to understand?  Yes  Partially  No Overall, how would you rate this comment?  Excellent  Good  Average  Submit  |  Cancel  
  
04/06/09 02:58 PM, ID: 24074859  


Rank: Guru

Was this comment helpful? Yes No duncancumming:ok, firstly
<cfif not IsDefined("Form.txtNumberInput")>

txtNumberInput is an input type of text, right?  Even if you don't type anything in, and submit the form, this value will always be defined.  Just it'll be an empty string.  Change that line to
<cfif not Len(Form.txtNumberInput)>


Secondly, the query you have immediately after that relies on Form.txtNumberInput, which you thought wasn't even defined?  Not sure what you were thinking of there.  What really happens is
select *
    from 335v where doc_no like '%%'
    order by doc_no

i.e. it'll get every row in the table I think.


Don't bother with this.  WriteOutput is sort of deprecated these days.
<cfScript>

        writeoutput(index);
       index=index+1;
</cfscript>
There's a much easier way, just output #get_FirstNo.CurrentRow#

Accept as Solution

    
    Please take a moment to respond  
    Did this comment work for you?  Yes  Partially  No Was the comment complete?  Yes  Partially  No Was the comment easy to understand?  Yes  Partially  No Overall, how would you rate this comment?  Excellent  Good  Average  Submit  |  Cancel  
  
04/06/09 03:26 PM, ID: 24074980  



Was this comment helpful? Yes No alexanderax:yes. txtNumberInput is specific as the (input name). I already edited the code but it still stated that i'm having error. ELEMENT txtNumberInput is undefined in form. error search_results.cfm: Line5
<cfif not IsDefined("Form.txtNumberInput")> Why is that so?Accept and Award Points Accept as Solution

    
    Please take a moment to respond  
    Did this comment work for you?  Yes  Partially  No Was the comment complete?  Yes  Partially  No Was the comment easy to understand?  Yes  Partially  No Overall, how would you rate this comment?  Excellent  Good  Average  Submit  |  Cancel  
  
04/07/09 01:26 AM, ID: 24079582  


Rank: Guru

Was this comment helpful? Yes No duncancumming:Either your page has no Form struct, or you've maybe made a typo in the fieldname and there is no field called txtNumberInput in your Form struct.
Accept as Solution

    
    Please take a moment to respond  
    Did this comment work for you?  Yes  Partially  No Was the comment complete?  Yes  Partially  No Was the comment easy to understand?  Yes  Partially  No Overall, how would you rate this comment?  Excellent  Good  Average  Submit  |  Cancel  
  
04/07/09 08:53 AM, ID: 24083181  



Was this comment helpful? Yes No alexanderax:What do you mean by fieldname anc? And how does form structure looks like? Can help me do my edit my code? Thanks for helpingAccept and Award Points Accept as Solution

    

Add to KnowledgeBase Stop Monitoring Share It! Printer Friendly Add Bookmark    

Point Value:
(Increase Only)
  ( Max: 500 Available Points: 0 ) Plain Text | Rich Text Comment:    Attach Code Snippet Copy and paste your code into the text area below. Your formatting will be preserved and your code syntax will be highlighted, when possible. Code Snippet:    [x] Allowed Extensions  
Experts Exchange accepts the following types of files:

bmp
doc
docx
gif
jpeg
jpg
log
mdb
pdf
png
txt
xls
xlsx
zip
  
  
Attach File
Uploaded files:


    

    
[x] Add New Email  
To make changes to your list of email addresses and groups, go to your Notification Preferences. You will then be asked to verify any new email addresses before Experts Exchange will allow you to associate them with a question.  
  
20081217-EE-VQP-LI-5 / EE_QW_3_20080625

donboe
04-14-2010 @ 11:40 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 474
Joined: Nov 2004

Sorry reaction to wrong message

This message was edited by donboe on 4-14-10 @ 11:40 PM


Website Designed and Developed by Pablo Varando.