6 Replies Latest reply on Jul 25, 2006 12:43 PM by briankind

    Enter in input box,  outputs the query/  record of the AN_id, To the query/display page.

    briankind
      Hello
      I have attempted to create a input text box to capture a alphanumeric data type , however it is not working for me yet.
      Can anyone help me here is the 2 new code I have added to my query results.
      Basically, I have 2 pages
      One is the input (index)
      And the other is where the logic is. / query

      I was working on a straight out query but now since I have added the code . it is not working yet?
      Can anyone help me?
      Thanks.
      And thanks

      In the input box, I have this in the index.cfm

      <label>Enter AN ID
      <input type="text" name="AN_ID"/>
      </label>

      In the where clause this is what I have of the query page or

      AN_ID = '#form.AN_ID#'

      below is all the code:

      index page

      Sorted by:  
      <select name="Orderby" size="1">
      <option value="AN_ID">AN ID</option>
      <option value="AN_DATE">AN DATE</option>
      </select>
      <br />
      <br />
      Output Format:
      <input type="radio" name="outputFormat" value="HTML" checked="checked" />
      HTML  
      <input type="radio" name="outputFormat" value="PDF" />
      PDF  
      <input type="radio" name="outputFormat" value="CSV" />
      Download/Open Excel Spreadsheet <BR />
      <BR />
      </p>
      </form>
      <p> </p>
      </div>

      <form id="form1" name="form1" method="post" action="">
      <label>Enter AN ID
      <input type="text" name="AN_ID"/>
      </label>
      ----------------------------------------------------------------------------------------- ------------------------------------------------------------

      query page and display page


      <cfquery name="getHIPPOcases" datasource="oracle10">
      Select
      Thecasertab.AN_ID as AN ID
      ,Thecasertab.AN_DATE as AN date
      ,Thecasertab_requi.case_requi_id
      ,Thecasertab_requi.requi_type_cd
      ,Thecasertab_requi.App_user_id


      from
      thold_case
      ,tloc
      ,tla_prop
      ,Thecasertab
      ,tref_plan_area
      ,Thecasertab_requi

      where
      Thecasertab_requi.caser_id = Thecasertab.caser_id
      and
      thold_case.caser_id = Thecasertab.caser_id
      and
      AN_ID = '#form.AN_ID#'



      order by

      <cfswitch expression="#Form.orderBy#">
      <cfcase value="AN_ID">
      CASE.AN_ID
      </cfcase>
      <cfcase value="AN_DATE">
      CASE.AN_date
      </cfcase>
      </cfswitch>


      </cfquery>


      <!---html report--->
      <cfswitch expression="#Form.outputFormat#">
      <cfcase value="HTML,PDF">

      <cfsavecontent variable="htmlData">
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns=" http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title>getHIPPOcases</title>
      </head>
      <style type="text/css">

      td{
      font-family:Arial, Helvetica, sans-serif;
      font-size:12px;
      }
      th{
      font-family:Arial, Helvetica, sans-serif;
      font-size:12px;
      font-weight:bold;
      background-color:#FFFF99;
      }
      h2{
      font-family:Arial, Helvetica, sans-serif;
      font-size:14px;
      }
      h3{
      font-family:Arial, Helvetica, sans-serif;
      font-size:15px;
      }
      </style>

      <body>
      <cfoutput>
      <table border="0" cellpadding="3" cellspacing="0">
      <tr>

      <td align="center">
      <h3>getHIPPOcases</h3><br><br></td>
      </tr>
      <tr>
      <td align="center">
      </h2>Your query returned #getHIPPOcases.RecordCount# records</h2></td>
      </tr>
      <tr>
      <td>
      <table border="2" cellpadding="2" cellspacing="0">
      <tr>
      <th>Record Number</th>
      <th width="120">AN ID</th>
      <TH>AN date</TH>

      </tr>

      <cfloop query="getHIPPOcases">


      <tr bgcolor="<cfif currentrow mod 2>GHOSTWHITE<cfelse>WHITE</cfif>">
      <td>#CurrentRow#</td>
      <Td>#AN_ID#</td>
      <td>#dateformat(AN_date,"mm/dd/yyyy")#</td>


      </tr>
      </cfloop>

      </table>
      </td>
      </tr>
      </table>

      </BODY>
      </HTML>
      </cfoutput>
      </cfsavecontent>

      <cfswitch expression="#Form.outputFormat#">

      <cfcase value="HTML">
      <cfoutput>
      #htmldata#
      </cfoutput>
      </cfcase>
      <cfcase value="PDF">
      PDF
      <cfdocument format="pdf">
      <cfoutput>
      #htmldata#
      </cfoutput>
      </cfdocument>
      </cfcase>

      </cfswitch>





      </cfcase>

      <cfcase value="CSV">


      <CFHEADER NAME="Content-Disposition" VALUE="attachment; filename=citywide.csv">
      <cfcontent type="application/msexcel">"AN ID","AN date"
      <cfoutput query="getHIPPOcases">#ltrim(AN_ID)#,"#dateformat(AN_date,"mm/dd/yyyy")#"
      </cfoutput>


      </cfcase>
      </cfswitch>



        • 1. Re: Enter in input box,  outputs the query/  record of the   AN_id,   To the query/display page.
          Level 7
          The string '_Date' is a reserved string used for a type of form
          validation. You will probably need to rename that field.

          SEE:
          http://livedocs.macromedia.com/coldfusion/7/htmldocs/00001385.htm

          briankind wrote:
          > Hello
          > I have attempted to create a input text box to capture a alphanumeric data
          > type , however it is not working for me yet.
          > Can anyone help me here is the 2 new code I have added to my query results.
          > Basically, I have 2 pages
          > One is the input (index)
          > And the other is where the logic is. / query
          >
          > I was working on a straight out query but now since I have added the code .
          > it is not working yet?
          > Can anyone help me?
          > Thanks.
          > And thanks
          >
          > In the input box, I have this in the index.cfm
          >
          > <label>Enter AN ID
          > <input type="text" name="AN_ID"/>
          > </label>
          >
          > In the where clause this is what I have of the query page or
          >
          > AN_ID = '#form.AN_ID#'
          >
          > below is all the code:
          >
          > index page
          >
          > Sorted by:  
          > <select name="Orderby" size="1">
          > <option value="AN_ID">AN ID</option>
          > <option value="AN_DATE">AN DATE</option>
          > </select>
          > <br />
          > <br />
          > Output Format:
          > <input type="radio" name="outputFormat" value="HTML" checked="checked" />
          > HTML  
          > <input type="radio" name="outputFormat" value="PDF" />
          > PDF  
          > <input type="radio" name="outputFormat" value="CSV" />
          > Download/Open Excel Spreadsheet <BR />
          > <BR />
          > </p>
          > </form>
          > <p> </p>
          > </div>
          >
          > <form id="form1" name="form1" method="post" action="">
          > <label>Enter AN ID
          > <input type="text" name="AN_ID"/>
          > </label>
          >
          > --------------------------------------------------------------------------------
          > ---------------------------------------------------------------------
          >
          > query page and display page
          >
          >
          > <cfquery name="getHIPPOcases" datasource="oracle10">
          > Select
          > Thecasertab.AN_ID as AN ID
          > ,Thecasertab.AN_DATE as AN date
          > ,Thecasertab_requi.case_requi_id
          > ,Thecasertab_requi.requi_type_cd
          > ,Thecasertab_requi.App_user_id
          >
          >
          > from
          > thold_case
          > ,tloc
          > ,tla_prop
          > ,Thecasertab
          > ,tref_plan_area
          > ,Thecasertab_requi
          >
          > where
          > Thecasertab_requi.caser_id = Thecasertab.caser_id
          > and
          > thold_case.caser_id = Thecasertab.caser_id
          > and
          > AN_ID = '#form.AN_ID#'
          >
          >
          >
          > order by
          >
          > <cfswitch expression="#Form.orderBy#">
          > <cfcase value="AN_ID">
          > CASE.AN_ID
          > </cfcase>
          > <cfcase value="AN_DATE">
          > CASE.AN_date
          > </cfcase>
          > </cfswitch>
          >
          >
          > </cfquery>
          >
          >
          > <!---html report--->
          > <cfswitch expression="#Form.outputFormat#">
          > <cfcase value="HTML,PDF">
          >
          > <cfsavecontent variable="htmlData">
          > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          > " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          > <html xmlns=" http://www.w3.org/1999/xhtml">
          > <head>
          > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
          > <title>getHIPPOcases</title>
          > </head>
          > <style type="text/css">
          >
          > td{
          > font-family:Arial, Helvetica, sans-serif;
          > font-size:12px;
          > }
          > th{
          > font-family:Arial, Helvetica, sans-serif;
          > font-size:12px;
          > font-weight:bold;
          > background-color:#FFFF99;
          > }
          > h2{
          > font-family:Arial, Helvetica, sans-serif;
          > font-size:14px;
          > }
          > h3{
          > font-family:Arial, Helvetica, sans-serif;
          > font-size:15px;
          > }
          > </style>
          >
          > <body>
          > <cfoutput>
          > <table border="0" cellpadding="3" cellspacing="0">
          > <tr>
          >
          > <td align="center">
          > <h3>getHIPPOcases</h3><br><br></td>
          > </tr>
          > <tr>
          > <td align="center">
          > </h2>Your query returned #getHIPPOcases.RecordCount# records</h2></td>
          > </tr>
          > <tr>
          > <td>
          > <table border="2" cellpadding="2" cellspacing="0">
          > <tr>
          > <th>Record Number</th>
          > <th width="120">AN ID</th>
          > <TH>AN date</TH>
          >
          > </tr>
          >
          > <cfloop query="getHIPPOcases">
          >
          >
          > <tr bgcolor="<cfif currentrow mod 2>GHOSTWHITE<cfelse>WHITE</cfif>">
          > <td>#CurrentRow#</td>
          > <Td>#AN_ID#</td>
          > <td>#dateformat(AN_date,"mm/dd/yyyy")#</td>
          >
          >
          > </tr>
          > </cfloop>
          >
          > </table>
          > </td>
          > </tr>
          > </table>
          >
          > </BODY>
          > </HTML>
          > </cfoutput>
          > </cfsavecontent>
          >
          > <cfswitch expression="#Form.outputFormat#">
          >
          > <cfcase value="HTML">
          > <cfoutput>
          > #htmldata#
          > </cfoutput>
          > </cfcase>
          > <cfcase value="PDF">
          > PDF
          > <cfdocument format="pdf">
          > <cfoutput>
          > #htmldata#
          > </cfoutput>
          > </cfdocument>
          > </cfcase>
          >
          > </cfswitch>
          >
          >
          >
          >
          >
          > </cfcase>
          >
          > <cfcase value="CSV">
          >
          >
          > <CFHEADER NAME="Content-Disposition" VALUE="attachment; filename=citywide.csv">
          > <cfcontent type="application/msexcel">"AN ID","AN date"
          > <cfoutput
          > query="getHIPPOcases">#ltrim(AN_ID)#,"#dateformat(AN_date,"mm/dd/yyyy")#"
          > </cfoutput>
          >
          >
          > </cfcase>
          > </cfswitch>
          >
          >
          >
          >
          >
          • 2. Re: Enter in input box,  outputs the query/  record of the AN_id, To the query/display page.
            Dan Bracuk Level 5
            In what way is your app not working?

            It might have something to do with the spaces in your alias names.

            Select
            Thecasertab.AN_ID as AN ID
            • 3. Re: Enter in input box,  outputs the query/  record of the AN_id, To the query/display page.
              briankind Level 1
              on the input
              i enter an_id value lets say lov-1234-oop-ui

              and
              presst the button
              it does notreturn the results (nothing happens)

              space issue,
              the query was working before the input box.

              until i have added the input box then it is not working.

              thanks
              • 4. Re: Enter in input box,  outputs the query/  record of the   AN_id,   To the query/display page.
                briankind Level 1
                OK,
                thanks


                In the input box, I have this in the index.cfm

                <label>Enter AN ID
                <input type="text" name="AN_ID"/>
                </label>

                In the where clause this is what I have of the query page or

                AN_ID = '#form.AN_ID#'



                ------------------------------------------------------------------------------------------ -------------------------------------------------
                index

                Sorted by:  
                <select name="Orderby" size="1">
                <option value="AN_ID">AN ID</option>
                <option value="AN_dt">AN dt</option>
                </select>
                <br />
                <br />
                Output Format:
                <input type="radio" name="outputFormat" value="HTML" checked="checked" />
                HTML  
                <input type="radio" name="outputFormat" value="PDF" />
                PDF  
                <input type="radio" name="outputFormat" value="CSV" />
                Download/Open Excel Spreadsheet <BR />
                <BR />
                </p>
                </form>
                <p> </p>
                </div>

                <form id="form1" name="form1" method="post" action="">
                <label>Enter AN ID
                <input type="text" name="AN_ID"/>
                </label>
                ----------------------------------------------------------------------------------------- ------------------------------------------------------------

                query page


                <cfquery name="getHIPPOcases" datasource="oracle10">
                Select
                Thecasertab.AN_ID as AN ID
                ,Thecasertab.AN_dt as AN dt
                ,Thecasertab_requi.case_requi_id
                ,Thecasertab_requi.requi_type_cd
                ,Thecasertab_requi.App_user_id


                from
                thold_case
                ,tloc
                ,tla_prop
                ,Thecasertab
                ,tref_plan_area
                ,Thecasertab_requi

                where
                Thecasertab_requi.caser_id = Thecasertab.caser_id
                and
                thold_case.caser_id = Thecasertab.caser_id
                and
                AN_ID = '#form.AN_ID#'



                order by

                <cfswitch expression="#Form.orderBy#">
                <cfcase value="AN_ID">
                CASE.AN_ID
                </cfcase>
                <cfcase value="AN_dt">
                CASE.AN_dt
                </cfcase>
                </cfswitch>


                </cfquery>


                <!---html report--->
                <cfswitch expression="#Form.outputFormat#">
                <cfcase value="HTML,PDF">

                <cfsavecontent variable="htmlData">
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                <html xmlns=" http://www.w3.org/1999/xhtml">
                <head>
                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
                <title>getHIPPOcases</title>
                </head>
                <style type="text/css">

                td{
                font-family:Arial, Helvetica, sans-serif;
                font-size:12px;
                }
                th{
                font-family:Arial, Helvetica, sans-serif;
                font-size:12px;
                font-weight:bold;
                background-color:#FFFF99;
                }
                h2{
                font-family:Arial, Helvetica, sans-serif;
                font-size:14px;
                }
                h3{
                font-family:Arial, Helvetica, sans-serif;
                font-size:15px;
                }
                </style>

                <body>
                <cfoutput>
                <table border="0" cellpadding="3" cellspacing="0">
                <tr>

                <td align="center">
                <h3>getHIPPOcases</h3><br><br></td>
                </tr>
                <tr>
                <td align="center">
                </h2>Your query returned #getHIPPOcases.RecordCount# records</h2></td>
                </tr>
                <tr>
                <td>
                <table border="2" cellpadding="2" cellspacing="0">
                <tr>
                <th>Record Number</th>
                <th width="120">AN ID</th>
                <TH>AN dt</TH>

                </tr>

                <cfloop query="getHIPPOcases">


                <tr bgcolor="<cfif currentrow mod 2>GHOSTWHITE<cfelse>WHITE</cfif>">
                <td>#CurrentRow#</td>
                <Td>#AN_ID#</td>
                <td>#dateformat(AN_dt,"mm/dd/yyyy")#</td>


                </tr>
                </cfloop>

                </table>
                </td>
                </tr>
                </table>

                </BODY>
                </HTML>
                </cfoutput>
                </cfsavecontent>

                <cfswitch expression="#Form.outputFormat#">

                <cfcase value="HTML">
                <cfoutput>
                #htmldata#
                </cfoutput>
                </cfcase>
                <cfcase value="PDF">
                PDF
                <cfdocument format="pdf">
                <cfoutput>
                #htmldata#
                </cfoutput>
                </cfdocument>
                </cfcase>

                </cfswitch>





                </cfcase>

                <cfcase value="CSV">


                <CFHEADER NAME="Content-Disposition" VALUE="attachment; filename=citywide.csv">
                <cfcontent type="application/msexcel">"AN ID","AN dt"
                <cfoutput query="getHIPPOcases">#ltrim(AN_ID)#,"#dateformat(AN_dt,"mm/dd/yyyy")#"
                </cfoutput>


                </cfcase>
                </cfswitch>


                • 5. Re: Enter in input box,  outputs the query/  record of the AN_id, To the query/display page.
                  Dan Bracuk Level 5
                  quote:

                  Originally posted by: briankind
                  on the input
                  i enter an_id value lets say lov-1234-oop-ui
                  and
                  presst the button
                  it does notreturn the results (nothing happens)
                  thanks

                  In that case, hard code the value 'lov-1234-oop-ui' into your query instead of the form variable. Do you get a result?

                  • 6. Re: Enter in input box,  outputs the query/  record of the AN_id, To the query/display page.
                    briankind Level 1
                    yes
                    i = to this nymber in quotes

                    it works

                    but i dont know what is wrong with my code.

                    thanks