CFM
<html>
<head>
<title>Test Page</title>
<script type="text/javascript">
function toggleV(value){
document.getElementById('blah').value = value;
}
</script>
</head>
<body>
<cfform name="coolfrm">
<cfinput type="hidden" name="blah" id="blah" value="default">
<a onclick="toggleV('anothervalue')" style="cursor:pointer;">click Me</a>
</cfform>
<cfdiv bind="cfc:TestCFC.func({coolfrm:blah})"></cfdiv>
</body>
</html>
CFC
<cfcomponent>
<cfscript>
remote function func(simpleString){
return simpleString;
}
</cfscript>
</cfcomponent>
What I expect this code to do is change the text in the cfdiv from “default” to “anothervalue”.
This doesn’t work the way I think it should, and I would like to know why.
By definition from: http://www.w3.org/TR/html4/interact/scripts.html
The change event isn’t firing correctly when you modify the field programmatically.
Solve this by changing the JavaScript function slightly: