Solved

cfinput error: Invalid token 'C' found

Posted on 2006-06-13
7
2,222 Views
Last Modified: 2013-12-24
I have:

<cfinput <CFIF session.myTransactionMode eq "addPayment" AND session.myPaymentID neq "">disabled</CFIF>
tabindex="#myTab#" type="text" name="GiftDate" id="GiftDate" size="10" maxlength="10" onChange="formatDate(this);"
class=notetext2  onkeyup="PopulateDate(event);" accesskey="Z"
required="yes" message="Please enter Gift Date!"
value="<CFIF isDate(form.GiftDate)>#DateFormat(form.GiftDate,'m/d/yyyy')#<CFELSE>#form.GiftDate#</CFIF>">

This returns:

Invalid token 'C' found on line 143 at column 11.  
The CFML compiler was processing:

a cfinput tag beginning on line 143, column 2.
 
How do you fix this?

0
Comment
Question by:JohnLucania
7 Comments
 
LVL 9

Assisted Solution

by:73Spyder
73Spyder earned 20 total points
ID: 16895994
class=notetext2

I think this should be this:

class="notetext2"
0
 

Author Comment

by:JohnLucania
ID: 16896136
still getting:

Invalid token 'C' found on line 143 at column 11.  
The CFML compiler was processing:

a cfinput tag beginning on line 143, column 2.

<cfinput <CFIF session.myTransactionMode eq "addPayment" AND session.myPaymentID neq "">disabled</CFIF>
tabindex="#myTab#" type="text" name="GiftDate" id="GiftDate" size="10" maxlength="10" onChange="formatDate(this);"
class="notetext2"  onkeyup="PopulateDate(event);" accesskey="Z"
required="yes" message="Please enter Gift Date!"
value="<CFIF isDate(form.GiftDate)>#DateFormat(form.GiftDate,'m/d/yyyy')#<CFELSE>#form.GiftDate#</CFIF>">
0
 
LVL 7

Assisted Solution

by:ExpertAdmin
ExpertAdmin earned 100 total points
ID: 16896423
I don't have a lot of insight on what may be causing it, but I would like to point out that this style of coding makes finding these types of errors very difficult. You may want to consider restructuring this statement more like this:

<CFIF session.myTransactionMode eq "addPayment" AND session.myPaymentID neq "">
     <CFSET Disabled ="disabled">
<CFELSE>
      <CFSET Disabled=""
</CFIF>


<CFIF IsDate(form.GiftDate)>
    <CFSET MyDate =DateFormat(form.GiftDate,'m/d/yyyy')>
</CFELSE>
        <CSET MyDate = form.GiftDate>
</CFIF>

<cfinput #Disabled# tabindex="#myTab#" type="text" name="GiftDate" id="GiftDate" size="10" maxlength="10" onChange="formatDate(this);"
class="notetext2"  onkeyup="PopulateDate(event);" accesskey="Z"
required="yes" message="Please enter Gift Date!" value="#MyDate#">

While this takes a little more code, it is much easier to see syntax errors and also to find out where an offending piece of code is.

M@
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 36

Assisted Solution

by:SidFishes
SidFishes earned 50 total points
ID: 16896654
not 100 % sure but i think the issues is you are trying to nest a cfif inside a cfinput...

afaik...you can do this kind of thing with a regular input tab but not within another cf tag as the parser sees

<cfinput <cfif

and throws an error because as far as it knows cfinput is unclosed

0
 
LVL 3

Assisted Solution

by:siva350
siva350 earned 30 total points
ID: 16897561
try this

<cfinput <CFIF session.myTransactionMode eq 'addPayment' AND session.myPaymentID neq ''>disabled</CFIF>
tabindex="#myTab#" type="text" name="GiftDate" id="GiftDate" size="10" maxlength="10" onChange="formatDate(this);"
class="notetext2"  onkeyup="PopulateDate(event);" accesskey="Z"
required="yes" message="Please enter Gift Date!"
value="<CFIF isDate(form.GiftDate)>#DateFormat(form.GiftDate,'m/d/yyyy')#<CFELSE>#form.GiftDate#</CFIF>">
0
 
LVL 3

Expert Comment

by:siva350
ID: 16897616
Nevermind, that wont work. HAve you tried using inline iif statements?
http://livedocs.macromedia.com/coldfusion/6/CFML_Reference/functions-pt1117.htm
0
 
LVL 18

Accepted Solution

by:
Plucka earned 300 total points
ID: 16898292
JohnLucania,

You CAN NOT use a <CFIF within <CFINPUT

You can do this with standard <INPUT tags.

This will work

<cfset dis = "" />
<cfif session.myTransactionMode eq "addPayment" AND session.myPaymentID neq "">
    <cfset dis = "disabled" />
</cfif>

<cfif isDate(form.GiftDate)>
    <cfset dat = DateFormat(form.GiftDate,'m/d/yyyy') />
<cfelse>
    <cfset dat = form.GiftDate />
</cfif>

<cfinput #dis# tabindex="#myTab#" type="text" name="GiftDate" id="GiftDate" size="10" maxlength="10" onChange="formatDate(this);"
class=notetext2  onkeyup="PopulateDate(event);" accesskey="Z" required="yes" message="Please enter Gift Date!" value="#dat#" />

Regards
Plucka
0

Featured Post

Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

Join & Write a Comment

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now