Invalid CFML Construct Found...

Discussion in 'Programming' started by JLG2, Jul 14, 2008.

  1. #1
    Hello to any and everyone,

    I'm getting the error below when trying to run a small form.

    Error Occurred While Processing Request
    Invalid CFML construct found on line 18 at column 6.
    ColdFusion was looking at the following text:

    >

    The CFML compiler was processing:

    * a cfif tag beginning on line 18, column 2.
    * a cfif tag beginning on line 18, column 2.
    * a cfif tag beginning on line 18, column 2.


    Please try the following:

    * Enable Robust Exception Information to provide greater detail about the source of errors. In the Administrator, click Debugging & Logging > Debugging Settings, and select the Robust Exception Information option.
    * Check the ColdFusion documentation to verify that you are using the correct syntax.
    * Search the Knowledge Base to find a solution to your problem.

    Browser Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0
    Remote Address 127.0.0.1
    Referrer http://localhost/goldstar/goldStar.cfm
    Date/Time 14-Jul-08 04:35 PM


    Here is the ColdFusion code on the form page:

    <cfquery name="rsGoldStar" datasource="HRTraining">
    SELECT *
    FROM dbo.tblEmployees
    WHERE Active = 1
    ORDER BY LastName ASC</cfquery>




    <form action="thanksGS.cfm" id="form1" name="form1" method="POST">
    <h3>

    </h3>
    <table width="68%" border="0" cellspacing="0" cellpadding="4">
    <tr>
    <td width="100%"><h2><strong>Referred by: </strong></h2></td>
    </tr>
    <tr>
    <td><select name="EmployeeID">
    <cfoutput query="rsGoldStar">
    <option value="#rsGoldStar.EmployeeID#">#rsGoldStar.LastName#, #rsGoldStar.FirstName#</option>
    </cfoutput>
    </select>
    <strong><span class="style3 style2">(Required)</span></strong></td>
    </tr>
    </table>
    <table width="518" border="0">
    <tr>
    <td width="177"><h2>Date:</h2></td>
    <td width="331"><input name="GoldCardDate" type="text" id="GoldCardDate" size="8" maxlength="8" /></td>
    </tr>
    <tr>
    <td><h2>Aplicant Name: </h2></td>
    <td><input name="AplicantName" type="text" id="AplicantName" size="40" maxlength="50" /></td>
    </tr>
    <tr>
    <td><h2>Position Applying For: </h2></td>
    <td><input name="PositionApplyingFor" type="text" id="PositionApplyingFor" size="50" maxlength="75" /></td>
    </tr>
    </table>
    <h2>&nbsp;</h2>
    <p><input type="submit" name="Submit" value="submit" />
    <label>
    <input name="Reset" type="reset" id="Reset" value="Reset" />
    </label>
    <label></label>
    </p>
    </form>


    _______

    Code On Results Page:

    <cftry>
    <cfloop list="#form.fieldnames#" index="fieldName">
    <cfif>
    <cfquery name="insertRow" datasource="HRTraining">
    INSERT INTO tblGoldCards (EmployeeID, GoldCardDate, ApplicantName, PositionApplyingFor)
    VALUES (#Evaluate("form." & fieldName)#, #form.EmployeeID#, #form.GoldCardDate#, '#form.ApplicantName#', '#form.PositionApplyingFor#')
    </cfquery>
    </cfif>
    </cfloop>
    </cfquery>

    <!--- If you sign up for a twice ERROR--->
    <cfcatch type="database">
    <cfif cfcatch.Message CONTAINS "violation of unigue key">
    <cfoutput>
    <h2> INPUT ERROR!</h2>
    <h3>Be aware you are attempting to register for a class you are already registered for. Please return to the form and try again. If you continue to have problems please contact the Human Resource department at 293-2615</h3>
    </cfoutput>
    </cfif>
    <cfrethrow />
    <cfabort>
    </cfcatch>
    </cftry>


    ANY HELP WOULD BE GREAT.
     
    JLG2, Jul 14, 2008 IP
  2. dshuck

    dshuck Peon

    Messages:
    92
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    A couple of immediate issues. Your exception is most likely due to the line under "Code Results on Page" that is simply:

    <cfif>

    The cfif condition expects a left and right comparison and will throw an exception they way that you have it written.

    Additionally, and not related to that exception, I see that you are looking for the cfcatch.message string "violation of unigue key". Check the way you spelled "unique", as you will never hit a match the way that it is currently written.
     
    dshuck, Jul 15, 2008 IP