Solved

cfinput error: Invalid token 'C' found

Posted on 2006-06-13
7
2,229 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
Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
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 demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

932 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

11 Experts available now in Live!

Get 1:1 Help Now