Solved

cfinput error: Invalid token 'C' found

Posted on 2006-06-13
7
2,275 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Suggested Solutions

Title # Comments Views Activity
Website being blocked? 3 127
Connect to MS-SQL server from Linux/PHP 8 85
In IIS redirect browser clients that do not support TLS 1.2 to another site 3 102
http to https 3 62
This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
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.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

777 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