Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Simple update not so simple

New Here ,
Mar 31, 2010 Mar 31, 2010

Ok, I am not a programmer but have made a couple of basic entry and search pages that have worked out very very well.  Now i am stuck, i made a simple search page, then once you find the one you want you click on the linked (url) detail.  This takes you to the Details/Update page.  This page displays the details that were already in the row and then has cfinputs for the data that needs to be added to the row.  Those 3 pages work fine, it isn't until the validation page when i get the error...thank you very very very much....

     The reason it is set up this way is to make completly sure that the correct row is being updated with the new information.  Trying to limit the amount of errors.  I have pasted teh pertinent code, but it is all in nice tables and tables rows with table data

DETAILS/UPDATE code (updatedetails.cfm)

    <!--- Create WHERE clause from data entered via search form    
        <cfset WhereClause = " 0=0 "> --->
    <!--- Build subclause for PurchasePermitNumber        
    <cfif Form.PurchasePermitNumber IS NOT "">           
        <cfset WhereClause = WhereClause & " and PurchasePermitNumber = '" & form.PurchasePermitNumber & "'" >
    </cfif>   --->

<cfquery name="Permitresult" datasource="GUNDESK">
SELECT *
FROM guns
WHERE PurchasePermitNumber='#url.PurchasePermitNumber#'
</cfquery>

<body>
<!--- OUTPUT QUERY --->
    <cfoutput query="Permitresult">
<!--- UPDATE RECORD --->
<cfform action="updatevalidatetest.cfm" method="post">

<!---  EMBED HIDDEN PERMIT FIELD
         <cfoutput>
            <input type="hidden" name="lookup" value="#FORM.PurchasePermitNumber#">
        </cfoutput> --->

<tr>

      <td><div align="center">#Permitresult.PurchasePermitNumber# </div></td>

          <td><div align="center">
               <cfinput type="text"
                  name="MAKE"
                  message="You Must enter the Make of Gun ie..Glock"
                  maxlength="10"
                  required="no"
                  size="10">
           </div></td>

</tr>

         <tr><td>   <input type="submit" value="UPDATE" /></td></tr>

VALIDATION CODE...(updatevalidatetest.cfm)

     <!--- Create WHERE clause from data entered via search form --->   
        <cfset WhereClause = " 0=0 ">
    <!--- Build subclause for PurchasePermitNumber --->       
    <cfif #FORM.PurchasePermitNumber# IS NOT "">           
        <cfset WhereClause = WhereClause & " and PurchasePermitNumber = '" & #FORM.PurchasePermitNumber#     & "'" >
    </cfif>          


<!--- UPDATE PERMIT --->   
<cfquery datasource="GUNDESK">
UPDATE guns
SET    Caliber=#Trim(FORM.Caliber)#
    COLOR=#Trim(FORM.COLOR)#
    DateReturnedDPD=#Trim(FORM.DateReturnedDPD)#
    MAKE=#Trim(FORM.MAKE)#
    MODEL=#Trim(FORM.MODEL)#
    NOTES=#Trim(FORM.NOTES)#
    SerialNumber=#Trim(FORM.SerialNumber)#
    WeaponPurchased=#Trim(FORM.WeaponPurchased)#
    WeaponType=#Trim(FORM.WeaponType)#
WHERE PurchasePermitNumber='#FORM.PurchasePermitNumber#'
</cfquery>


<table align="center">
    <tr>
        <td><cfinclude template="header.cfm"></td>
    </tr>
</table>

<!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>WEAPON PERMIT ENTRY</title></head>

<body>
<!--- FEED BACK --->
<cfoutput>
<h1>Purchase Permit Number '#FORM.PurchasePermitNumber#' was UPDATED</h1>
</cfoutput>

<!--- RETURN TO RESULTS AND SEARCH PAGES --->
    <table border="2" align="center">
        <tr>
            <td>
                <strong><a href="PermitUpdate.cfm" title="Permit Update Search">Return to Update Permit Page</a></strong></td>
      </tr>
</table>
</body>
</html>

ERROR MESSAGE I GET WHEN I HIT THE UPDATE PAGE...

Element PURCHASEPERMITNUMBER is undefined in FORM.

The error occurred in C:\ColdFusion8\wwwroot\GunDesk\UPDATEVALIDATEtest.cfm: line 4

2 :         <cfset WhereClause = " 0=0 ">
3 :     <!--- Build subclause for PurchasePermitNumber --->       
4 :     <cfif #FORM.PurchasePermitNumber# IS NOT "">           
5 :         <cfset WhereClause = WhereClause & " and PurchasePermitNumber = '" & #FORM.PurchasePermitNumber#     & "'" >
6 :     </cfif>          

Ok, I think that is all i have that keeps stopping me as of right now....

any help that anyone can give me on this will be monumental for us...thank you

Taco

244
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 31, 2010 Mar 31, 2010

Your are missing a <cfinput> field named "purchasepermitnumber" in the form which submits to page with the validation code.

The code you pasted is not perhaps complete, because I couldn't see even </cfform> closing the <cfform>...

-Fernis

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 31, 2010 Mar 31, 2010
LATEST

i didnt put the cfform tags in to try and keep my post short and to the point, but they are in there.  The data that is populating the "Details/Update page comes from the search results page.  Since half the page is filled out when you first come in to get a permit.  all they need initially to begin is your basics, name, address, phone, permit date, permit expiration date and the permit number.  i have set up the search page to search by permit number or name.  that brings up the basic search results page which is pushed by the cfoutput process and gives name, address and permit date and number.  with the number being a url to the details page.  the details page is both an output and update.  The basic fields like name, address, phone, permit date, and permit number are output fields displaying what is already in the row of the database.  the update fields are set up with the cfinput tags like make, model caliber, purchase date.  that is the information that will be added when the person returns to finish the process.

now i do have an insert page that has all the fields as inputs and works fine.  but that is only for the records that they will be typing in by hand to start populating the database.  It works great, but i can not get this Details/Update page to work.

As for the permit number not having a cfinput, are they going to have to type it in again after they typed it in the first time in the update search?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources