Solved

CF Form isn't updating field values into the database

Posted on 2006-11-08
7
159 Views
Last Modified: 2013-12-24
I create this form that is supposed enable a user to insert records into a table.  However when I click on the save button it just takes me back to the action page without inserting the data.  I have the code that displays the form on one page and the qry to insert the form field values on another page.  Also, our company uses Oracle for its database

                                                                        HERE IS THE CODE FOR THE FORM PAGE

<cfinclude template="qry_update.cfm">

<cfform name="addrec" action="index.cfm?" method="post">
  <table width="379" border="1">
   <tr>
      <th scope="row"><div align="left">
        <!--- User inserts todays date here --->
        <label>Date
        <cfinput name="Date_Preapproval" validate="date" message="Please use the MM/DD/YYYY format for the date"
             type="text" value="#dateformat(now(),'MM/DD/YYYY')#" > 
        </label>
      </div></th>
    </tr>
   <tr><!--- Displays Vendor  --->
     <th scope="row"><div align="left">
       <label>Vendor
       <input type="text" name="Vendor" readonly="yes" value="<cfoutput>#request.vendornbr#</cfoutput>" />
       </label>
     </div></th>
   </tr>
    <tr><!--- Users Display name is inserted here --->
      <th scope="row"><div align="left">
        <label>Coordinator
        <input name="COORDINATOR" readonly="yes" type="text" id="coordinator" value="<cfoutput>#Request.logEmpname#</cfoutput>" />
        </label>
      </div></th>
    </tr>
    <tr><!--- Value can be null --->
      <th scope="row"><div align="left">
        <label>Contact Name
        <input name="CONTACTNAME"  type="text" id="contactname" maxlength="100" />
        </label>
      </div></th>
    </tr>
    <tr><!--- Value can be null --->
      <th scope="row"><div align="left">
        <label>Fax Number
        <input name="FAX" type="text" id="fax" maxlength="10" />
        </label>
      </div></th>
    </tr>
    <tr><!--- Value can be null --->
      <th scope="row"><div align="left">
        <label>Email
        <input name="EMAIL" type="text" id="email" maxlength="100" />
        </label>
      </div></th>
    </tr>
    <tr><!--- Integer Data type --->
      <th scope="row"><div align="left">
        <label>Expected Cost
        <input name="EXPECTEDCOST" type="text"  id="expectedcost" />
        </label>
      </div></th>
    </tr>
    <tr>
      <th scope="row"><div align="left">
        <label>Planned Activity
        <select name="EntryCode" id="EntryCode">
            <cfoutput query="plannedactivity">
            <option value="#entrycode#">#descr#</option>
            </cfoutput>
        </select>
        </label>
      </div></th>
    </tr>
    <tr><!--- Value can be null --->
      <th scope="row"><div align="left">
        <label>Price Point
        <input name="PRICEPOINT" type="text" id="pricepoint" />
        </label>
      </div></th>
    </tr>
    <tr>
      <th scope="row"><div align="left">
        <label>status
        <select name="STATUS" size="1" id="status">
             <cfoutput query="status">
             <option value="#status#">#status#</option>
             </cfoutput>
        </select>
        </label>
      </div></th>
    </tr>
    <tr>
      <th scope="row"><div align="left">
        <label>Notes
        <textarea name="notes" id="notes"></textarea>
        </label>
        </div></th>
    </tr>
    <tr>
      <th scope="row"><div align="left">
        <label>DateReceived
        <cfinput name="Date_received"  validate="date" message="Please use the MM/DD/YYYY format for the date" type="text" />
        </label>
      </div></th>
    </tr>
      <tr><input name="ActionDate" type="hidden" value="#dateformat(now(),'MM/DD/YYYY')#" />
            <input name="ActionUser" type="hidden" value="<cfoutput>#request.logemplid#</cfoutput>">
      <th scope="row"><input name="Save" type="submit" id="Save" value="Save">
        <input type="reset" name="reset" value="reset" />
      <td valign="bottom" rowspan="9">&nbsp;</td>
      </tr>
  </table>

</cfform>      

                                                                          HERE IS THE CODE FOR THE QRY PAGE

<!--- This query is used to display the planned activity values from the co-op entry codes table --->
<cfquery name="plannedactivity" datasource="#request.datasource#">
select entrycode, descr
from coop_entry_codes
order by entrycode
</cfquery>
<!--- Used to display the status list from the coop_status table --->
<cfquery name="status" datasource="#request.datasource#">
select status
from
(
select decode(status,'New',1,2) as colorder, status
from coop_status
)
order by colorder
</cfquery>
<!--- This query updates the coop_preapprovals table using the addrec form on the dsp_update page--->
<cfif isdefined('form.save')>
<cfquery datasource="#request.datasource#" name="update">
INSERT INTO COOP_PREAPPROVALS (
   PREAPPROVAL_ID,
   DATE_PREAPPROVAL,
   VENDOR,
   COORDINATOR,
   CONTACTNAME,
   FAX,
   EMAIL,
   EXPECTEDCOST,
   ENTRYCODE,
   PRICEPOINT,
   STATUS,
   NOTES,
   DATE_RECEIVED,
   ACTIONUSER,
   ACTIONDATE)
VALUES <!---The Coop_PreApprovals_ID is supposed to be automatically generated once the user clicks the save button on the form--->
(COOP_PREAPPROVALS_SEQ.nextval,
#Form.Date_Preapproval#,
'#Form.Coordinator#',
'#Form.ContactName#',
'#Form.Fax#',
'#Form.Email#',
'#Form.ExpectedCost#',
'#Form.EntryCode#',
'#Form.PricePoint#',
'#Form.Status#',
'#Form.Notes#',
#Form.Date_Received#,
'#Form.ActionUser#',
#Form.ActionDate#)
</cfquery>
</cfif>

Does anyone have any suggestions?
0
Comment
Question by:rudodoo
  • 3
  • 2
7 Comments
 
LVL 20

Expert Comment

by:trailblazzyr55
ID: 17900769
do you get any errors?

0
 

Author Comment

by:rudodoo
ID: 17901115
I wasn't before but now I made some corrections.  And I receive this error

 unique constraint (TableName.PK_COOP_PREAPPROVALS) violated  
 
0
 

Author Comment

by:rudodoo
ID: 17901376
I solved the problem, what happened was that I wasn't using CGI.Variable scripts in the cfform action tag.  Everything works now. Please close this question
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 20

Expert Comment

by:trailblazzyr55
ID: 17901434
cool, glad you figured it out ;o)
0
 
LVL 20

Expert Comment

by:trailblazzyr55
ID: 17916493
I agree to PAQ/Refund, rudodoo was able to solve the issue, no help needed from me. rudodoo provided the solution on 11/08/2006 12:26PM PST and has responded to comments..

regards,
~trail
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 17964390
PAQd, 500 points refunded.

DarthMod
CS Moderator
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question