javascript doent work in the page rendered by cfwindow
I have some javascript loaded in a cfwindow. I call the javascript function on click of a button. The following is the code loaded in cfwindow.. When I click a button JS error shows up saying : setVendorPayee is not defined function onclick(event) { setVendorPayee("126", "sudheer"); }(click clientX=397, clientY=139) when i actually have the function in there... please help
<script type="text/javascript">
function getRecords1(){
return true;
}
function setVendorPayee(vendorID,vendorName) {
if (ColdFusion.Window.getWindowObject('VendorPayeeSearch_CFWindow')){alert('hi');
document.ExpenseForm.payeeField#url.row#.value=vendorName;
document.ExpenseForm.payee_Person_ID#url.row#.value=vendorID;
ColdFusion.Window.hide('VendorPayeeSearch_CFWindow');
}
else if (window.opener && !window.opener.closed) {
window.opener.document.ExpenseForm.payeeField#url.row#.value=vendorName;
window.opener.document.ExpenseForm.payee_Person_ID#url.row#.value=vendorID;
window.close();
}
}
</script>
<cfform name="VendorForm" id="VendorForm" method="post" onsubmit="getRecords1();">
<table id="myTable" border="0" cellpadding="0" cellspacing="0" width="100%" class="noBorder">
<cfif Arguments.query.RecordCount>
<tr class="baseColorMedium">
<td align="center" > </td>
<td align="center" ><strong>Vendor Name</strong></td>
<td align="center" ><strong>Address 1</strong></td>
<td align="center" ><strong>Address 2</strong></td>
<td align="center"><strong>City</strong></td>
<td align="center" ><strong>State</strong></td>
<td align="center" ><strong>Zip Code</strong></td>
<td align="center" ><strong>Vendor Type</strong></td>
</tr>
<cfelse>
Your search did not return any results. Please modify your search criteria
</cfif>
<cfloop query="Arguments.query" >
<cfscript>
if (Arguments.query.CurrentRow mod 2 EQ 0) {
bgcolortoggle = "gridRowEven";
}
else {
bgcolortoggle = "gridRowOdd";
}
</cfscript>
<tr class="#bgcolortoggle#">
<td align="center"><cfinput type="button" name="btnSelect_#arguments.query.vendor_code#" value="Select" onClick ="setVendorPayee('#arguments.query.vendor_code#','#arguments.query.vendor_name#');" class="submitButton" /></td>
<td align="center">#HTMLEditFormat(trim(ucase(arguments.query.vendor_name)))#</td>
<td align="center">#HTMLEditFormat(trim(ucase(arguments.query.address_1)))#</td>
<td align="center">#HTMLEditFormat(arguments.query.Address_2)#</td>
<td align="center">#HTMLEditFormat(arguments.query.city)#</td>
<td align="center">#HTMLEditFormat(arguments.query.state)#</td>
<td align="center">#HTMLEditFormat(arguments.query.zip_code)#</td>
<td align="center">#HTMLEditFormat(arguments.query.vendor_type)#</a></td>
</tr>
</cfloop>
<tr>
<td width="100%" class="noBorder" colspan="8">
</td>
</tr>
<tr>
<td width="100%" class="noBorder" colspan="8">
开发者_运维问答 <cfinput type="submit" id="btnSearch" name="btnAddNewVendor" value="Add Vendor" class="submitButton" />
</td>
</tr>
</table>
</cfform>
I did some research for you and can't find anything relating to any oddities or quirks in using onClick with cfinput.
The only thing that comes to mind to try would be to take the script block and place it outside of the cfwindow content.
I'm not sure if that would make a difference, but that is what I would try first.
Might need to add <cfajaximport tags="cfform">
, see if it helps.
精彩评论