Solved

Coldfusion 10  EVALUATE

Posted on 2015-01-06
19
68 Views
Last Modified: 2015-01-27
The code below use to work in ColdFusion MX7. Upgraded to ColdFusion 10 and don't work no more.



<CFLOOP INDEX="ListIndex" LIST="#TRIM(UserGroup)#">
            
            <CFSET UserGroup = SpanExcluding(ListIndex, "|*|")>            
            <CFSET UserGroupType = Replace(ListIndex, "|*|","")>
            <CFSET UserGroupType = Replace(UserGroupType, UserGroup,"")>      
            
            
            
            
                  

            <CFSET StartDate = EVALUATE("FORM.StartDate#TRIM(UserGroup)##TRIM(UserGroupType)#")>
            <CFSET EndDate = EVALUATE("FORM.EndDate#TRIM(UserGroup)##TRIM(UserGroupType)#")>
            <CFSET OnGoing = EVALUATE("FORM.OnGoing#TRIM(UserGroup)##TRIM(UserGroupType)#")>
            <CFSET TempEndDate = EVALUATE("FORM.TempEndDate#TRIM(UserGroup)##TRIM(UserGroupType)#")>
            <CFSET SubscriberAcctNumber = EVALUATE("FORM.SubscriberAcctNumber#TRIM(UserGroup)##TRIM(UserGroupType)#")>

            <!--- check SubscriberAcctNumber length and pad with leading zeroes, if necessary --->
            <CFIF IsDefined("SubscriberAcctNumber") AND LEN(TRIM(SubscriberAcctNumber)) GT 0>
                  <CFIF LEN(TRIM(SubscriberAcctNumber)) LT 7 AND TRIM(SubscriberAcctNumber) GT "">
                        <CFSET SubscriberAcctNumberLength = LEN(TRIM(SubscriberAcctNumber))>
                        <CFLOOP CONDITION="SubscriberAcctNumberLength LT 7">
                              <CFSET SubscriberAcctNumber = 0 & TRIM(SubscriberAcctNumber)>
                              <CFSET SubscriberAcctNumberLength = LEN(SubscriberAcctNumber)>
                        </CFLOOP>
                  </CFIF>
            </CFIF>

            <CFQUERY NAME="AddModUser" DATASOURCE="DB">
                  { CALL prMembership       
                        ('#TRIM(UserID)#','#TRIM(UserGroup)#','#TRIM(UserGroupType)#','#TRIM(StartDate)#','#TRIM(EndDate)#','#TRIM(TempEndDate)#','','','#TRIM(OnGoing)#','#TRIM(SubscriberAcctNumber)#')      
                  }
            </CFQUERY>
            
      </CFLOOP>
0
Comment
Question by:smares323
  • 13
  • 6
19 Comments
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility
You forgot to ask a question!

But since you mention evaluate()  you can remove evaluate by doing this...

  <CFSET StartDate = FORM["StartDate#TRIM(UserGroup)##TRIM(UserGroupType)#"]>

instead of this..

  <CFSET StartDate = EVALUATE("FORM.StartDate#TRIM(UserGroup)##TRIM(UserGroupType)#")>
0
 

Author Comment

by:smares323
Comment Utility
I get this error on the insert.

{ CALL prMembership       ('112973','WSJ','REGULAR','01/01/10,01/01/20','','','','','y,y','') }
0
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility
That is not an error, what is the error message?

The thing that looks weird is  'y,y'  --- is that supposed to be two "y" ? or just "Y"

same thing with the date..t. here are 2 dates in this quote..

01/01/10,01/01/20
0
 

Author Comment

by:smares323
Comment Utility
Ok the Evaluate use to filter the multiple records that where submitted.  that's actually 2 grouptype  that were selected and its not looping the startdate  and ongoing for each record. The Y is for the Ongoing field.
0
 

Author Comment

by:smares323
Comment Utility
In the past the   Evaulate was for more then 1 record that was submitted through the form.

<CFSET StartDate = EVALUATE("FORM.StartDate#TRIM(UserGroup)##TRIM(UserGroupType)#")>
             <CFSET EndDate = EVALUATE("FORM.EndDate#TRIM(UserGroup)##TRIM(UserGroupType)#")>
             <CFSET OnGoing = EVALUATE("FORM.OnGoing#TRIM(UserGroup)##TRIM(UserGroupType)#")>
             <CFSET TempEndDate = EVALUATE("FORM.TempEndDate#TRIM(UserGroup)##TRIM(UserGroupType)#")>
             <CFSET SubscriberAcctNumber = EVALUATE("FORM.SubscriberAcctNumber#TRIM(UserGroup)##TRIM(UserGroupType)#")>
0
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility
> In the past the   Evaulate was for more then 1 record that was submitted through the form.

Ok, that was the past.  How is it now?  Do you still have more than one record in your form?   How are you looping them now?
0
 

Author Comment

by:smares323
Comment Utility
Also MX7 the Evaulate would allow each startdate to insert in its own UserGroup record not like this 01/01/10,01/01/20
0
 

Author Comment

by:smares323
Comment Utility
<!---------------->
<CFPARAM NAME="UserID" DEFAULT="">



<CFIF TRIM(UserID) GT "">

      <CFQUERY NAME="Subscribed" DATASOURCE="db">
            { CALL prUGMembership ('#TRIM(UserID)#') }
      </CFQUERY>      
      <!--- <cfdump var="#Subscribed#"> --->
      
      <CFQUERY NAME="AllGroups" DATASOURCE="db">
            { CALL prUGTypesList }
      </CFQUERY>
      <!--- <cfdump var="#AllGroups#"> --->
<CFELSE>
      <CFABORT>
</CFIF>



      <CFSET GroupList = "">
      <CFSET OnGoingList = "">
      
      <CFOUTPUT QUERY="Subscribed">
            
            <CFSET GroupList = "#TRIM(GroupList)##TRIM(UserGroup)##TRIM(UserGroupType)#,">            
            <!-- 101,239,48,39,932 -->
            <CFIF TRIM(OnGoing) IS "Y">
                  <CFSET OnGoingList = "#TRIM(OnGoingList)##TRIM(UserGroup)##TRIM(UserGroupType)#,">
            </CFIF>            
      </CFOUTPUT>
      

      
      
      
<HTML>
<HEAD>
<Style Type="text/css">
.link1 {text-decoration:none; color:#000000;}
.button0 {font-size:7pt;}
.textEntry1 {font:9pt}
</Style>
</HEAD>

<BODY bgcolor="#ffffff" vlink=blue alink=blue>



<CFOUTPUT>
<FORM name="GroupForm" action="/admin/onlineAccount/userGroupSub.cfm?sid=#sid#&tkn=#tkn#&UserID=#UserID#" METHOD="POST" TARGET="list">
</CFOUTPUT>



<TABLE border=0 cellspacing=0 cellpadding=0 width=99%>
<TR>
<td width=5><spacer type=block></td>
<td>
      
      <table border=0 cellspacing=2 cellpadding=0 width=100%>         
      
      <TR bgcolor="#eeeeee">      
      <td colspan=2><font face=arial,helvetica size=1>
            <u>Available Groups</u>
      </td>
      <td><font face=arial,helvetica size=1>
            <u>Region</u>
      </td>
      <td><font face=arial,helvetica size=1>
            <u>On Going</u>
      </td>
      <td><font face=arial,helvetica size=1>
            <u>Subscriber<br>Account</u>
      </td>
      <td><font face=arial,helvetica size=1>
            <u>Start Date</u>
      </td>
      <td><font face=arial,helvetica size=1>
            <u>End Date</u>
      </td>
      </TR>
      
      <CFOUTPUT QUERY="AllGroups">
      
            
      <CFSET zGroup = "#TRIM(AllGroups.UserGroup)##TRIM(AllGroups.UserGroupType)#">
      <CFSET zTempEndDate = "">
      <CFSET zStartDate = "">
      <CFSET zEndDate = "">
      <CFSET zSubscriberID = "">

      <TR>            

            <td valign=top>                      
                  <input type="Checkbox" name="UserGroup" value="#TRIM(AllGroups.UserGroup)#|*|#TRIM(AllGroups.UserGroupType)#"<CFIF TRIM(GroupList) CONTAINS "#TRIM(AllGroups.UserGroup)##TRIM(AllGroups.UserGroupType)#"> checked</CFIF>>
          </td>         
            
            <td><font face=arial,helvetica size=1>                  
                <a href="##" title="#TRIM(AllGroups.UserGroupName)#" Class="link1">
                      #TRIM(AllGroups.UserGroup)# #TRIM(AllGroups.UserGroupType)#</a>
          </td>             
            
            <td><font face=arial,helvetica size=1>                  
                 #LEFT(RegionCode, 2)#          
               </td>
   
          <td>                  
                  <input type="text" size=1 name="OnGoing#TRIM(Subscribed.UserGroup)##TRIM(Subscribed.UserGroupType)#" value="<CFIF TRIM(OnGoingList) CONTAINS "#TRIM(AllGroups.UserGroup)##TRIM(AllGroups.UserGroupType)#">Y</CFIF>" Class="textEntry1">
               </td>    
 
             <td>
               <CFLOOP QUERY="Subscribed">
                    <CFIF "#TRIM(zGroup)#" IS "#TRIM(Subscribed.UserGroup)##TRIM(Subscribed.UserGroupType)#">
                              <CFSET zSubscriberID = "#Subscribed.SubscriptionAccountNumber#">
                              <CFSET zStartDate = DateFormat("#TRIM(Subscribed.StartDate)#","mm/dd/yy")>
                              <CFSET zEndDate = DateFormat("#TRIM(Subscribed.EndDate)#","mm/dd/yy")>
                              <CFSET zTempEndDate = DateFormat("#TRIM(Subscribed.TempEndDate)#","mm/dd/yy")>
                        </CFIF>
                  </CFLOOP>
                  
                  <!--- baseview account number ---><!--- #TRIM(Subscribed.UserGroup)##TRIM(Subscribed.UserGroupType)# --->
                  <input type="text" name="SubscriberAcctNumber#TRIM(Subscribed.UserGroup)##TRIM(Subscribed.UserGroupType)#" value="#zSubscriberID#" size="7" maxlength="30" Class="textEntry1">
            </td>
            <td>
                  <input type="text" name="StartDate#TRIM(Subscribed.UserGroup)##TRIM(Subscribed.UserGroupType)#" value="#TRIM(zStartDate)#" size=7 maxlength=30 Class="textEntry1">
            </td>
            <td><input type="text" name="EndDate#TRIM(Subscribed.UserGroup)##TRIM(Subscribed.UserGroupType)#" value="#TRIM(zEndDate)#" size=7 maxlength=30 Class="textEntry1">  
                     <input type="hidden" name="TempEndDate#TRIM(Subscribed.UserGroup)##TRIM(Subscribed.UserGroupType)#" value="#TRIM(zTempEndDate)#">
            </td>                  
                  
      </TR>
      
      <CFIF zSubscriberID GT ''>
            <!--- query baseview --->
            <CFQUERY NAME="CA" DATASOURCE="CIRC">
                  SELECT subscription.account, subscription.status, subscription.expiration,
                        publication.publication_name, occupant.company, subscription.notes, publication.publicationcode
                  FROM subscription
                  INNER JOIN publication ON subscription.publicationID = publication.publication_id
                  INNER JOIN occupant ON occupant.name_id = subscription.namedentityid
                  WHERE subscription.account = '#zSubscriberID#'
            </CFQUERY>      
            <!--- <cfdump var="#CA#"> --->
            <CFIF IsDefined("CA.account") AND CA.account GT 0>
                  <tr>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td valign="top">
                              <font face=arial,helvetica size=1>                  
                              #CA.account#
                              <br />#CA.publication_name# <cfif trim(CA.publicationcode) gt "">(#trim(CA.publicationcode)#)</cfif>
                              <br />#CA.company#
                              <br />#CA.notes#
                        </td>
                        <td valign="top">
                                    <font face=arial,helvetica size=1>
                                    Status: #TRIM(CA.status)#
                                    <br /><CFIF #TRIM(CA.status)# EQ 1>Active<CFELSE><font color="red">Inactive</font></CFIF>
                                    </font>
                        </td>
                        <td valign="top">
                                    <font face=arial,helvetica size=1>                  
                                    Exp: #DateFormat(CA.expiration, "mm/dd/yy")#
                                    </font>
                        </td>                  
                  </tr>
            </CFIF>
      </CFIF>
      </CFOUTPUT>            
       
    <TR>
      <td colspan=5 height=50 align=center>
            <input type=submit value="  Save  " Class="button0">
      </td>
      </TR>
            
      </table>  
      

</td>
</TR>
<TR><td height=50>&nbsp;</td></TR>
</TABLE>


</form>
</BODY>
</HTML>
0
 

Author Comment

by:smares323
Comment Utility
That's how in the form
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:smares323
Comment Utility
In the form im using a cfquery output to get usergroup value
0
 

Author Comment

by:smares323
Comment Utility
Any suggestions or advice gdemaria
0
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility
So, the problem is these two columns that are doubling the data, right?

{ CALL prMembership       ('112973','WSJ','REGULAR','01/01/10,01/01/20','','','','','y,y','') }

What is the name of the form field for this data:  '01/01/10,01/01/20

AND for this data :  'Y,Y'

We need to see if these fields are set up differently, they should have a name tag with a variable  NAME="XXX#variable#"
0
 

Author Comment

by:smares323
Comment Utility
form.StartDate = 01/01/10,01/01/20
form.EndDate = doing the same
form.OnGoing = y,y
form.TempEndDate = doing the same
form.SubscriberAcctNumber = doing the same
0
 

Author Comment

by:smares323
Comment Utility
Sorry I think you meant this

name="OnGoing#TRIM(Subscribed.UserGroup)##TRIM(Subscribed.UserGroupType)#"
name="StartDate#TRIM(Subscribed.UserGroup)##TRIM(Subscribed.UserGroupType)#"
name="EndDate#TRIM(Subscribed.UserGroup)##TRIM(Subscribed.UserGroupType)#"
name="TempEndDate#TRIM(Subscribed.UserGroup)##TRIM(Subscribed.UserGroupType)#"
name="SubscriberAcctNumber#TRIM(Subscribed.UserGroup)##TRIM(Subscribed.UserGroupType)#"
0
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility
So they are all duplicating?

On your form page, view the source and look for the startDate field

 <input type="text" name="StartDate#TRIM(Subscribed.UserGroup)##TRIM(Subscribed.UserGroupType)#"

You will probably see more than one field named  StartdateX where x is some value.    NAME="StartDateX" should be unique, there should only be one of them, the "X" value (whatever it is) needs to be different every time
0
 

Author Comment

by:smares323
Comment Utility
gdemaria you were right about the name being unique, but I'm still getting an error if the recordcount is more then 19 records that the form submits. The evaluate did work also.

HTTP Status 500 - ROOT CAUSE:

type Exception report

message ROOT CAUSE:

description The server encountered an internal error that prevented it from fulfilling this request.

exception
0
 

Author Comment

by:smares323
Comment Utility
type Exception report

message ROOT CAUSE:

description The server encountered an internal error that prevented it from fulfilling this request.

exception
javax.servlet.ServletException: ROOT CAUSE:
java.lang.IllegalStateException: Cannot call sendError() after the response has been committed
      at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:450)
      at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:119)
      at coldfusion.tagext.io.cache.ehcache.GenericResponseWrapper.sendError(GenericResponseWrapper.java:91)
      at coldfusion.filter.FormScope.parseQueryString(FormScope.java:524)
      at coldfusion.filter.FormScope.parsePostData(FormScope.java:468)
      at coldfusion.filter.FormScope.fillForm(FormScope.java:414)
      at coldfusion.filter.FormScope.setEncoding(FormScope.java:86)
      at coldfusion.runtime.CFPage.SetEncoding(CFPage.java:1194)
      at cfclassic2ecfm557356615._factor21(C:\ColdFusion10\cfusion\wwwroot\WEB-INF\debug\classic.cfm:19)
      at cfclassic2ecfm557356615._factor32(C:\ColdFusion10\cfusion\wwwroot\WEB-INF\debug\classic.cfm:12)
      at cfclassic2ecfm557356615.runPage(C:\ColdFusion10\cfusion\wwwroot\WEB-INF\debug\classic.cfm:1)
      at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:244)
      at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:446)
      at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
      at coldfusion.filter.CfincludeFilter.include(CfincludeFilter.java:33)
      at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:114)
      at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
      at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
      at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:58)
      at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
      at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
      at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
      at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:151)
      at coldfusion.CfmServlet.service(CfmServlet.java:219)
      at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
      at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:422)
      at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:199)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:722)

      coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:70)
      coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)



note The full stack trace of the root cause is available in the Apache Tomcat/7.0.54 logs.
0
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
Comment Utility
I actually just had this problem myself - it took me forever to find the solution!

This is a setting in the CFIDE/administrator because you have a lot of fields.   The setting limits the number of fields.

Go into the admin and choose Server Settings -> Settings and scroll down to find
Maximum number of POST request parameters

Change the value from 100 to something like 500.  That's the number of fields a form can post
0
 

Author Closing Comment

by:smares323
Comment Utility
I also found the same solution. thanks for you time and effort.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 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

14 Experts available now in Live!

Get 1:1 Help Now