Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Issues

Status
Not open for further replies.

RTDesi

MIS
Apr 17, 2001
24
US
Hey, I'm somewhat COMPLETELY new to ColdFusion. I'm trying to accomplish some form-related tasks. Basically, what I have now is a form w/ a few textfields and checkboxes. Basically, the names of the checkboxes correspond to the tables in the database. So, whichever checkboxes are checked, I want to send the information in the txtboxes to those particular table in the database. As of now, all the values of the checkboxes is 1. Here's some code to support the above :

iccinput.cfm

<form enctype=&quot;multipart-form-data&quot; method=&quot;post&quot; action=&quot;iccupload.cfm&quot; name=&quot;upload&quot;>

(I'm also uploadin a file, hence the enctype)

<table width=&quot;100%&quot; border=&quot;1&quot; cellspacing=&quot;8&quot;>

Your Name <input name=&quot;txtName&quot; size=&quot;30&quot; maxlength=&quot;255&quot;>

Title for your Document<input name=&quot;txtSubject&quot; size=&quot;50&quot; maxlength=&quot;255&quot; >

Description <TEXTAREA name=&quot;txtDesc&quot; rows=&quot;5&quot; cols=&quot;50&quot;></TEXTAREA>

<input type=&quot;file&quot; name=&quot;fileUp&quot; size=&quot;40&quot; maxlength=&quot;255&quot;>

Departments
<input type=&quot;checkbox&quot; name=&quot;cboxFinancial&quot; value=&quot;1&quot;>
<input type=&quot;checkbox&quot; name=&quot;cboxManufacturing&quot; value=&quot;1&quot;>

and a bunch of other departments set up exactly like this...
so basically, I dont know where to put the SQL statement...since the form action is &quot;iccupload.cfm&quot; do I insert the sql statment there? That is where I currently have it:

iccupload.cfm

<html>
<head>
<CFQUERY NAME=&quot;insertFinancial&quot; DATASOURCE=&quot;iccupload&quot;>
<cfif form.cboxFinancial is &quot;1&quot;>
INSERT INTO FINANCIAL (NAME, SUBJECT, DESCRIPTION,)
values
(#Form.txtName#,#Form.txtSubject#,#Form.txtDesc#)
</cfif>
</CFQUERY>
</head>

<body>

</body>

</html>

that is what my whole iccupload.cfm file looks like. Do I need to add anything to it to link it to the previous page (iccinput2.cfm)?

This is the error I'm getting w/ the current code:

Syntax error in INSERT INTO statement.
The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (8:1) to (8:55).



 
Hi RTDesi,


Try this:

values ('#Form.txtName#','#Form.txtSubject#','#Form.txtDesc#')

You forgot the '' signs, that will hopefully help you out!

Regards
Bram
 
Good lookin out on that, but I dont think it even gets that far b/c the error reads :
The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (8:1) to (8:55).

So it doesn't even reach that part...although I did add the quotes...thanks

Any other sugguestions?
 
Hi RTDesi,


Did you try to do:

<cfif #form.cboxFinancial# eq 1>

Instead of:
<cfif form.cboxFinancial is &quot;1&quot;>

Tip: once I read that checking a value is done faster if you use: eq 1 instead of using is &quot;1&quot; ....

If this would not work, let me know.

Regards
Bram
 
Thanks, that's an excellent tip...I figured out why it wasnt working..I referenced form in the # tag, but the form was on the previous page...so I jus have it as '#txtName#' now instead of '#Form.txtName#'
I appreciate all the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top