House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

ColdFusion 9 cfgrid get value from added textbox

  << Previous Post |  RSS |  Subscribe to this Group Next >> 

CF9 cfgrid get value from added textbox

What I am trying to do is get the value of a textbox that I have added to my Shaun McCoy 05/29/2012 11:11 AM

05/29/2012 11:11 AM
Author: Shaun McCoy Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63953#351351 What I am trying to do is get the value of a textbox that I have added to my grid via button click. Here is the code that I have used so far: This is where I add the button and textbox. [code] <cfset queryAddcolumn(rstResults, "add", arrayNew(1))>         <cfset queryAddcolumn(rstResults, "qty", arrayNew(1))>         <cfloop query="rstResults">           <cfset querySetCell(rstResults, "add", "<input value='Add To Cart' type='button' onclick='javascript:testit2()'><input type='button' value='Details' onclick='javascript:testit()'>",currentrow)>             <cfset querySetCell(rstResults, "qty", "<input id='qty2' value='' type='text' size='1' maxlength='4'>", currentrow)>         </cfloop> [/code] Here is the javascript for the button click. ( I know I have to functions that are doing the same thing, it is two buttons I was just testing to make sure they were giving me the information I wanted.) [code] <script>     myproxy = new myproxy();     myproxy.setCallbackHandler(handleResult);          function testit(){       var itemID = ColdFusion.getElementValue('items', 'iResults', 'ItemId');       var qty = ColdFusion.getElementValue('items', 'iResults', 'qty2').value;       myproxy.getData(itemID, qty);     }              function testit2(){       var itemID = ColdFusion.getElementValue('items', 'iResults', 'ItemId');       var qty = ColdFusion.getElementValue('items', 'iResults', 'qty2').value;       myproxy.getData(itemID, qty)     }          function handleResult(r){       alert("Result: "+r);     }   </script> [/code] Here is the code for the grid. [code] <cfform name="iResults" id="iResults">                 <br />                      <b>Search:</b> <input type="text" name="search" id="search">             <cfinput type="checkbox" checked="no" name="guide" id="guide"> My Guide<br/>                           <cfgrid attributeCollection="#VARIABLES.gridConfig#">                           <cfgridcolumn name="ItemId" header="Item" width="50" />               <cfgridcolumn name="Brand" header="Brand" width="75" />                 <cfgridcolumn name="Description" header="Description" width="200" />                 <cfgridcolumn name="Pack" header="Pack" width="75" />                 <cfgridcolumn name="Date" type="date" header="Last Ordered" width="100" />                 <cfgridcolumn name="pbsuprice" type="numeric" header="Your Price" width="75" />                 <cfgridcolumn name="pbretailprice" type="numeric" header="Retail Price" width="75" />                 <cfgridcolumn name="UOM" header="UOM" width="75" />                 <cfgridcolumn name="Qty" header="Qty" width="60" />               <cfgridcolumn name="Add" header="Add to Cart" width="200" />             </cfgrid>                 </cfform> [/code] So far all I have been able to get when I try to reference that column is the actual code that is used to create the textbox.
<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 23, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference