Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CF Form isn't updating field values into the database

Posted on 2006-11-08
7
Medium Priority
?
196 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
6 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
What You Need to Know when Searching for a Webhost Provider
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

782 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