Binding Form Elements to Query Data


hello,

 

i have simple form thati'm binding query data can populates cselect box and, based on selection, populate cfinput boxes. have code form in <cfinclude template> , working designed.

 

but strangely enough, if wrap <cfinclude> code contains form in <cfdiv> tags, binding breaks.

 

what causing that? super appreciated.

 

-brian

 

main page code form:

<cfajaximport tags="cfform,cfdiv">

  <cfdiv>

     <cfinclude template="vehiclelog.cfm">   

  </cfdiv>

 

cfinclude file:

<cfform name="addmileage" method="post" action="actionpages/addmileage.cfm">

         <table cellpadding="10">

         <tr><td>

          <fieldset>

          <legend>

          <img src="images/service_vehicle.png" alt="vehicle log" /> <strong>vehicle log </strong> </legend>

        

          <table width="100%" border="0" cellpadding="5">

                  <tr>

                    <td><label>service vehicle:</label></td>

                    <td><cfselect queryposition="below" name="vehicle_name" id="vehicle_name" value="vehicle_name" bind="cfc:cfcs.mileagedata.getdata()" bindonload="true" >

                    </cfselect>                    </td>

                  </tr>

                  <tr>

                    <td>origin:<br />

                      <label></label></td>

                    <td><cfinput name="origin" type="text" /></td>

                  </tr>

                  <tr>

                    <td>destination:</td>

                    <td><cfinput name="destination" type="text" /></td>

                  </tr>

                  <tr>

                    <td><label>start odometer:</label></td>

                    <td><cfinput onfocus="startodometercalc();" name="start_odometer" type="text" bind="cfc:cfcs.mileagedata.getdetail({vehicle_name})" bindattribute="value" bindonload="true"/></td>

                  </tr>

                  <tr>

                    <td>end odometer:</td>

                    <td><cfinput onfocus="startodometercalc();" id="end_odometer" name="end_odometer" type="text"  bind="cfc:cfcs.mileagedata.getdetail({vehicle_name})" bindattribute="value" bindonload="true"/></td>

                  </tr>

                  <tr>

                    <td><label>total mileage:</label></td>

                    <td><cfinput onfocus="startodometercalc();" id="total_mileage" name="total_mileage" type="text" /></td>

                  </tr>

                  <tr>

                    <td><label>expenses:</label></td>

                    <td><cfinput value="0.00" name="expenses" type="text" /></td>

                  </tr>

                  <tr>

                    <td><cfinput type="submit" name="submit" id="submit" value="submit" /></td>

                    <td> </td>

                  </tr>

                </table>

          </fieldset>

          </td></tr></table></cfform>

 

cfcs

<!---service vehicle slect box --->

<cffunction name="getdata" access="remote" returntype="query">

    <cfoutput>

    <!--- function data datasource --->

    <!---get service vehicles --->

    <cfquery name="data" datasource="#datasource#">

    select vehicle_name

    vehicles

    active = '1'

    </cfquery>

    </cfoutput>

   

    <!--- return results --->

    <cfreturn data>

</cffunction>

 

 

<cffunction name="getdetail" access="remote" returntype="string">

    <cfargument name="vehicle_name" type="any" required="true">

 

 

    <!--- localize function variables --->

    <cfset var datadetail = "">

    <cfoutput>

    <cfquery name="datadetail" datasource="#datasource#">

        select mileage

        from   vehicles

        <!--- adjust cfsqltype if needed --->

        vehicle_name = <cfqueryparam value="#arguments.vehicle_name#" cfsqltype="cf_sql_varchar">

    </cfquery>

          </cfoutput>

    <cfreturn datadetail.mileage>

</cffunction></cfcomponent>



i found else out. if remove <cfform> tags template file, has form div, bindings work.? i'm totally confused.

 

so how supposed submit form in cfdiv without submiting form on main page????

 

-brian



More discussions in ColdFusion Rich Forms


adobe

Comments

Popular posts from this blog

Upgrade 3.4.8 to 3.5.1 failed "download package failed" - Joomla! Forum - community, help and support

Joomal 3.6.3 update error - PHP temporary folder is not set - Joomla! Forum - community, help and support

Fatal error during instalation - Joomla! Forum - community, help and support