Solved

cfinput error: Invalid token 'C' found

Posted on 2006-06-13
7
2,290 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
Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

828 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