My goal is to have the textboxes border change from "none" to "solid" or back again based on onclick of an associated checkbox.
The problem is that the border is not changing, or not staying set depending on how I do it.
I'll start with the javascript because that is probably the source of the problem:
There are no exceptions thrown, and the radnumericTextbox does turn readOnly or not readOnly based on the checkbox, but I can't see the border change. When I did an alert on the ActualField.style.border it did say "medium solid -moz-use-text-color" (obviously I am testing Firefox, but it also has to work for IE 7+).
After looking at the rendered source I decided to try:
which did show the border, but only until I moused over it (I have no other events set other than what I've mentioned here), so that doesn't really seem like a solution.
For reference here is one line of my table, they are all the same just with different names.
.
The problem is that the border is not changing, or not staying set depending on how I do it.
I'll start with the javascript because that is probably the source of the problem:
function onCheckboxChanged(CheckboxField, ComputedValueField, ActualValueField) { |
//Checkbox has been checked |
var ActualField = document.getElementById(ActualValueField); |
alert(ActualField.id); |
if (document.getElementById(CheckboxField).checked == true) { |
var ComputedVal = document.getElementById(ComputedValueField).value; |
ActualField.value = ComputedVal; |
ActualField.readOnly = false; |
ActualField.style.border = "medium solid"; |
} |
else { |
ActualField.value = "0"; |
ActualField.readOnly = true; |
ActualField.style.border = "none"; |
} |
//alert(ActualField.style.border); |
CalculateActualTotals(); |
} |
After looking at the rendered source I decided to try:
var ActualField = document.getElementById(ActualValueField + "_text"); |
For reference here is one line of my table, they are all the same just with different names.
<tr> |
<td> |
<asp:CheckBox ID="chkCM" runat="server" onclick="onCheckboxChanged('chkCM','radnumComputedCM','radnumActualCM')"/> |
</td> |
<td> |
<asp:TextBox ID="txtAccNameCM" runat="server" BorderStyle="None" ReadOnly="true"/> |
</td> |
<td> |
<telerik:RadNumericTextBox ID="radnumComputedCM" runat="server" BorderStyle="None" ReadOnly="true" MaxValue="9999.99" |
EmptyMessage="$" NumberFormat-DecimalDigits="2" MinValue="0" CssClass="copysmall" Width="60px"> |
<NumberFormat DecimalDigits="2" PositivePattern="$n" /> |
</telerik:RadNumericTextBox> |
</td> |
<td> |
<telerik:RadNumericTextBox ID="radnumActualCM" runat="server" BorderStyle="None" ReadOnly="true" MaxValue="9999.99" |
EmptyMessage="$" NumberFormat-DecimalDigits="2" MinValue="0" CssClass="copysmall" Width="60px"> |
<NumberFormat DecimalDigits="2" PositivePattern="$n" /> |
</telerik:RadNumericTextBox> |
</td> |
</tr> |
.