I have one radio button at the top of the page to show 'No Chosen Supplier' and then several other radio buttons within a query loop.
<label>
<input type="radio" id="nosupp" name="supp" onchange="resetSupp(this);">
No Supplier Chosen
</label>
<cfloop query="supplier"
<label>
<input type="radio" id="chk1" name="supp" value="#supplier.id#" onchange="change(this);" <cfif getChosen.RecordCount>checked="Yes"</cfif>>
Chosen Supplier
</label>
</cfloop>
So I have submitted the form containing these buttons and the button that is checked is stored in the database.
I then query the database to check if the radio button value is 'true', using getChosen.RecordCount.
The problem I am having is that the getChosen.RecordCount selects the right radio button, but without the red highlighting that I am using.
Here is how I am highlighting the buttons:
<script type="text/javascript">
function change(obj) {
var tr=obj.parentNode.parentNode;
var tbl = tr.parentNode.parentNode;
var inputs = tbl.getElementsByTagName("input");
for(var i = 0;i<inputs.length;i++)
inputs[i].parentNode.parentNode.style.backgroundColor='transparent';
tr.style.backgroundColor=(obj.checked)? 'red' : 'transparent';
}
function resetSupp(obj) {
var tr=obj.parentNode.parentNode;
var tbl = tr.parentNode.parentNode;
var inputs = tbl.getElementsByTagName("input");
for(var i = 0;i<inputs.length;i++)
inputs[i].parentNode.parentNode.style.backgroundColor='transparent';
tr.style.backgroundColor= 'transparent';
}
</script>
How do I get the button that is set to 'true' in the database to have the highlighting on page load?