开发者

CFINPUT to update data in grid

开发者 https://www.devze.com 2023-02-22 15:31 出处:网络
I have CFINPUT text boxes (type= datefield) that are bound to a cfgrid. When a row is selected the input display from the grid\'s datastore.

I have CFINPUT text boxes (type= datefield) that are bound to a cfgrid.

When a row is selected the input display from the grid's datastore.

What I would like to do is not use the edit functionality of the grid since there is much coding involved with other controls to render the input boxes and other controls for my page.

开发者_如何学运维

I would like that when a change in made in the input text box the cfc is run to insert or update to the database.

Any suggestions?


I blv you should invoke cfc in the onchange of the cfinput. The code should look like:

function edit(eqp) { Do what ever you like }

The name of the cfgrid is equipmentList


You could use cfbind to do this, try something like this,

<cfinput name="inputName" type="text">
<cfinput name="rowID" type="hidden" value="#rowID#">

<cfdiv bind="url:anotherPage.cfm?IName={inputName@keyup}&RId={rowID}" bindOnLoad="false">

----In anotherPage.cfm----
  <cfinvoke
    component="CFC_name"
    method="Method_Name">    
      <cfinvokeargument name="I_Name" value="#trim(IName)#"/>
      <cfinvokeargument name="R_ID" value="#trim(RId)#"/>
 </cfinvoke> 

----In CFC---->
<cffunction name="CFC_name" access="remote">
  <cfargument name="I_Name" type="string" required="yes">
  <cfargument name="R_ID" type="string" required="yes">

  <cfquery name="Q1" datasource="ds">
    UPDATE Tbl1
    SET Col1=<cfqueryparam value="#arguments.I_Name#" cfsqltype="cf_sql_varchar">
    WHERE ID = #arguments.R_ID#
  </cfquery>
</cffunction> 

you could Bind by using, @keyup, @keydown, @change, @click etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号