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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351351
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm