Solved

Bind cfinput to cfselect on change in coldfusion 9

Posted on 2010-08-30
1
1,602 Views
Last Modified: 2012-05-10
Hello -

I'm trying to bind a cfinput to a url based on two changing cfselects. I keep getting an error: "Bind failed, element not found: BillToMonth [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]" (I get it for both elements, BillToMonth and MeterNo)

However, I use that specific variable when binding to a cfdiv on the same page. If I assign values and bind on load, then I get the suspected values returned appropriately.

Here's the code:
<cfajaximport tags = "cfdiv,cfgrid,cfform">
<cfset UserInfoCFC=CreateObject("Component","#pathtofunctions#.UserInfo")>
<cfset ChargeInfo=CreateObject("Component","#pathtofunctions#.CompleteInfo")>

<cfset qryUserInfo=UserInfoCFC.functionUserInfo(Session.MM_UserID)>
<cfset qryLastChargeDate=ChargeInfo.functionLastChargeDate(qryUserInfo.SiteID)>
<cfset qryActiveUtilities=ChargeInfo.functionActiveUtilities(qryUserInfo.SiteID)>
<cfset qryBuildings=ChargeInfo.functionSiteBuildings(qryUserInfo.SiteID)>
<cfset qryMeterNumbers=ChargeInfo.functionMeterNumbers(qryUserInfo.SiteID)>

<cfset pageTitle = "Resident Billing -  #qryUserInfo.CommunityName# Bill Entry">


<cftry>
  <cfset dateone = DateFormat(DateAdd("m", 1, "#qryLastChargeDate.MonthEndDate#"),"mm/dd/yyyy")>
  <cfset dateone = #DATEFORMAT(DateAdd("d",-1,DateAdd("m",1,CreateDate(Year(dateone),Month(dateone),1))),"mm/dd/yyyy")#>
  <cfset datetwo = DateFormat(DateAdd("m", 2, "#qryLastChargeDate.MonthEndDate#"),"mm/dd/yyyy")>
  <cfset datetwo = #DATEFORMAT(DateAdd("d",-1,DateAdd("m",1,CreateDate(Year(datetwo),Month(datetwo),1))),"mm/dd/yyyy")#>
  <cfset datethree = DateFormat(DateAdd("m", 3, "#qryLastChargeDate.MonthEndDate#"),"mm/dd/yyyy")>
  <cfset datethree = #DATEFORMAT(DateAdd("d",-1,DateAdd("m",1,CreateDate(Year(datethree),Month(datethree),1))),"mm/dd/yyyy")#>
  <cfset datefour = DateFormat(DateAdd("m", 4, "#qryLastChargeDate.MonthEndDate#"),"mm/dd/yyyy")>
  <cfset datefour = #DATEFORMAT(DateAdd("d",-1,DateAdd("m",1,CreateDate(Year(datefour),Month(datefour),1))),"mm/dd/yyyy")#>
<cfcatch>
  <cfset dateone = DateFormat(#DateAdd("d",-1,DateAdd("m",1,CreateDate(Year(Now()),Month(now())-1,1)))#,"mm/dd/yyyy")>
  <cfset datetwo = DateFormat(#DateAdd("d",-1,DateAdd("m",1,CreateDate(Year(Now()),Month(now()),1)))#,"mm/dd/yyyy")>
  <cfset datethree = DateFormat(#DateAdd("d",-1,DateAdd("m",1,CreateDate(Year(Now()),Month(now())+1,1)))#,"mm/dd/yyyy")>
  <cfset datefour = DateFormat(#DateAdd("d",-1,DateAdd("m",1,CreateDate(Year(Now()),Month(now())+2,1)))#,"mm/dd/yyyy")>

</cfcatch>
</cftry>

<cfoutput>

         <table width="850" border="0" cellspacing="0" cellpadding="0">
            <cfform name="ChargeMonthSelect" action="#request.myself#=#xfa.insertBill#">
            <cfinput type="hidden" name="SiteID" value="#qryUserInfo.SiteID#">
         	<tr>
            	<td rowspan="40" width="150">
                	<cfinclude template="dsp_inc_menu.cfm">
                </td>
            	<td>
                	<table>
            				<tr>
                        		<th align="left">
                                	Select Month for Utility Bill Entry: 
                                </td>
                                <td align="left">
                                	<cfselect name="BillToMonth">
                                    	<option value="#dateformat(dateone,"yyyy-mm-dd")#">#dateone#</option>
                                        <option value="#dateformat(datetwo,"yyyy-mm-dd")#">#datetwo#</option>
                                        <option value="#dateformat(datethree,"yyyy-mm-dd")#">#datethree#</option>
                                        <option value="#dateformat(datefour,"yyyy-mm-dd")#">#datefour#</option>
                                    </cfselect>
                                </td>
                        	</tr>
                            <tr>
                            	<th align="left">
                                	Invoice/Meter Number:
                                </th>
                                <td align="left">
                                	<cfselect name="MeterNo">
                                    	<option value=""></option>
                                    	<cfloop query="qryMeterNumbers">
                                        <option value="#qryMeterNumbers.MeterNo#">#MeterNo#</option>
                                        </cfloop>
                                    </cfselect>
                                </td>
                            </tr>
                    </table>
                </td>
            </tr>
            <tr>
            	<td><br /><br /></td>
            </tr>
            <tr>
            	<td>
                	<table>
                    		<tr>
                        		<th class="bordered">
                                	Utility Type
                                </th>
                                <th class="bordered">
                                	Amount
                                </th>
                                <th class="bordered">
                                	Allocate To:
                                </th>
                        	</tr>
                    	<cfloop query="qryActiveUtilities">
                        <cfinput type="hidden" name="UtilityID#qryActiveUtilities.CurrentRow#" value="#qryActiveUtilities.UtilityID#">
                        <cfinput type="hidden" name="TotalUtilitiesCount" value="#qryActiveUtilities.RecordCount#">
            				<tr>
                        		<td align="left" class="bordered">
                                	#UtilityDesc#
                                </td>
                                <td class="bordered">
                                	<cfinput type="text" name="UtilityTotal#qryActiveUtilities.CurrentRow#" size="8" bind="url:#request.myself#=#xfa.chargeamount#&UtilityID=#UtilityID#&SiteID=#qryUserInfo.SiteID#&meternumber={MeterNo@change}&BillToMonth={BillToMonth@change}" bindonload="yes">
                                </td>
                                <td class="bordered">
                                <cfif #AllocateTo# eq "Community">
                                	Community
                                    <input type="hidden" name="AllocateTo#qryActiveUtilities.CurrentRow#" value="Community" />
                                <cfelse>
                                	<cfselect name="AllocateTo#qryActiveUtilities.CurrentRow#">
                                        <option value="Building">Building</option>
                                        <option value="Community">Community</option>
                                    </cfselect>
                                </cfif>
                                </td>
                        	</tr>
                        </cfloop>
                        	<tr>
                                <td colspan="3" align="center">
                                    <input type = "submit" name = "submit" value = "Add Bill">
                                </td>
                            </tr>
                    </table>
                </td>
                
                </cfform><td>
                	<cfdiv id="chargesEnteredDiv" bindonload="true" bind="url:#request.myself#=#xfa.chargesentered#&monthenddate={BillToMonth@change}">
                    	<h3>Please select a date above</h3>
                    </cfdiv>
                </td>
            </tr>
            
        </table>
</cfoutput> 

Open in new window


Any help is greatly appreciated.

Thanks!
0
Comment
Question by:bruhast
1 Comment
 

Accepted Solution

by:
bruhast earned 0 total points
Comment Utility
This was resolved by moving my cfform tag outside of the html table tag.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

771 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