3 Replies - 769 Views - Last Post: 04 February 2011 - 07:15 AM Rate Topic: -----

#1 Guest_DominicDB*


Reputation:

Incorrect syntax on form basic form

Posted 03 February 2011 - 09:13 AM

Hey guys,
I've been trying to set up basic CF form, everytime i submit the information i get the following error:

Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near ')'.

The error occurred in C:\inetpub\wwwroot\carsoupcorp.com\Questionnaire.cfm: line 86

84 : '#form.advertiserrelations#',
85 : '#form.onlinexp#',
86 : '#form.companyinterest#')
87 : </CFQUERY>
88 :


I've rebuilt the form, looked over it, checked spelling.. still cant figure out what's wrong. Here's what i've got for the coding:

<!---Here's the form table--->

<cfform action="questionnaire.cfm?action=submit" method="post">
<table width="200" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td colspan="2" height="100">
            <div class="redHeadNews">QUESTIONNAIRE</div>
<CFIF Action IS "Submit">
<CFQUERY NAME="AddIt" DATASOURCE="#database#">
	INSERT INTO leads2 (
                                fname,
                                address,
                                city,
                                state,
                                zip,
                                country,
                                phone,
                                franchisetype,
                                ifcontent,
                                ifbranding,
                                dealerrelations,
                                advertiserrelations,
                                onlinexp,
                                companyinterest,)
	VALUES (
                                '#form.fname#',
                                '#form.address#',
                                '#form.city#',
                                '#form.state#',
                                '#form.zip#',
                                '#form.country#',
                                '#form.phone#',
                                '#form.franchisetype#',
                                '#form.ifcontent#',
                                '#form.ifbranding#',
                                '#form.dealerrelations#',
                                '#form.advertiserrelations#',
                                '#form.onlinexp#',
                                '#form.companyinterest#')
</CFQUERY>

              <P>We've received your information and will follow up with you shortly.</p>
<CFELSE>

              <P>Please provide your name, mailing address, email address, telephone number, and the company you represent.  </p>
</CFIF>
</td>
</tr>
<tr>
<tr>
                <TD width="66">Name: </td>
                <TD width="183"><cfinput type="text" name="fname" required="yes" message="Please enter your full name."></TD>
                <TD width="47"> </TD>
                <TD width="192"> </TD>
</TR>
<TR>
                <TD>Address:</td>
                <TD><cfinput type="text" name="address" required="yes" message="Please specify a valid address."></TD>
                <TD>City:</TD>
                <TD><cfinput type="text" name="city" required="yes" message="Please specify your city."></TD>
</TR>
<TR>
                <TD>State:</TD>
                <TD><cfinput type="text" name="state" required="yes" message="Please select a state"></TD>
                <TD>ZIP:</TD>
                <TD><cfinput type="text" name="zip" required="yes" message="Please specify a valid zip code."></TD>
</TR>
<TR>
                <TD>Country:</TD>
                <TD><cfinput type="text" name="country" required="yes" message="Please specify your country."></TD>
                <TD>Phone:</TD>
                <TD><cfinput type="text" name="phone" required="yes" message="Please specify your phone number."></TD>
</TR>
<TR>
                <TD COLSPAN="4">
<p>Type of franchise in which you are interested: <SELECT SIZE="1" NAME="franchisetype">
<option value=" "> </option>
<option value="Content">Content</option>
<option value="Branding">Branding</option>
</select><br />
                  <br />
                  If Content, please describe your connection with dealers  in your market and the reasons why you believe that you can organize  those dealers to participate in the CarSoup&reg; Program.<br />
<cftextarea name="ifcontent" cols="50" rows="1"></CFTEXTAREA><br />
                  <br />
                  If Branding, please describe the media you control in your market, including any online portal sites.<br />
<cftextarea name="ifbranding" cols="50" rows="1"></CFTEXTAREA><br />
                  <br />
                  Please describe any prior experience you or your company  has had in attempting to build strategic business relationships between  dealer groups and media companies<br />
<cftextarea name="dealerrelations" cols="50" rows="1"></CFTEXTAREA><br />
                  <br />
                  Please describe any prior experience you or your company  has had in attempting to build strategic business relationships with  advertisers in the automotive category.<br />
<cftextarea name="advertiserrelations" cols="50" rows="1"></CFTEXTAREA><br />
                  <br />
                  Please describe any relevant online experience that you or your company has had.<br />
<cftextarea name="onlinexp" cols="50" rows="1"></CFTEXTAREA><br />
                <br />
                Please describe the reasons why you think that a CarSoup&reg; franchise may be of interest to you or your company.<br />
<cftextarea name="companyinterest" cols="50" rows="1"></CFTEXTAREA>
                <br />
                <br />
                <strong><i>The information contained on this site does not  constitute an offer to sell a franchise. An offer of a franchise can  only be made after delivery of a Franchise Disclosure document.</strong></i>
                  </p>
                  <p>Copyright 2011. CarSoup Franchising, LLC, 1401 East American Boulevard, Suite 6, Bloomington, MN 55425 </p>
</TD>
</TR>
<TR>
                <TD COLSPAN="4"><div align="right"><BR/>
                  <input type="image" src="images/newsSubmitButton.jpg" alt="Submit"><br/><br/>
                  </div></TD>
</TR>
</TABLE>
</td>
</CFFORM>
<!---End Table--->


Is This A Good Question/Topic? 0

Replies To: Incorrect syntax on form basic form

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6109
  • View blog
  • Posts: 23,666
  • Joined: 23-August 08

Re: Incorrect syntax on form basic form

Posted 03 February 2011 - 09:20 AM

Moved to Cold Fusion
Was This Post Helpful? 0
  • +
  • -

#3 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1947
  • View blog
  • Posts: 3,488
  • Joined: 13-January 08

Re: Incorrect syntax on form basic form

Posted 03 February 2011 - 03:00 PM

I'd recommend you try cutting the entirety of lines 8 through 46 inclusive and paste them above your form display like at line 2 maybe.

You're opening a CFFORM and then in the middle of it (for no discernible reason) you're doing a database insert. The results message you're doing there will need to be changed a little but the way you're doing it now isn't recommended for a variety of reasons...not the least of which is that it's in a CFFORM.

A good practice to get into is to try and keep separate the sections of code you use for "work" and the sections you use for "display". Here you've got them all mixed in together and CFFORM uses some Java and Javascript and that may very well be interfering with the CFQUERY.

If you do that and it still isn't working, feel free to come back and we'll see what we can do.
Was This Post Helpful? 0
  • +
  • -

#4 Guest_DominicDB*


Reputation:

Re: Incorrect syntax on form basic form

Posted 04 February 2011 - 07:15 AM

Hey Craig328, thank for the response. I got it working yay! The error was that i had to remove the comma in " companyinterest,) " *facepalm*

Thanks for your suggestions, I haven't taken any classes for development, so hearing best practices on these are always helpful ^_^
Was This Post Helpful? 0

Page 1 of 1