I have this script in an external javascript file and I know it works mostly. The script is supposed to reset all of the fields I tell it to to a certain value. The only problem I’m having is with radial buttons. I get a field has no properties error message for these fields. My guess is that it has something to do with the [] that tell it which radial button to mark as checked. Does anyone have any ideas on how to fix this?
HTML Code:
[CODE]
<form id=”EstimateRequest” action=”/Pages/EstimateRequestDU.asp” method=”post” name=”EstimateRequest”>
<input type=”text” name=”txtFlatFinishedSize1″ size=”15″ maxlength=”20″ tabindex=”16″>
<input type=”radio” name=”grpCover1″ value=”Yes” tabindex=”18″> Yes
<input type=”radio” name=”grpCover1″ value=”No” tabindex=”19″> No
<input type=”radio” name=”grpCover1″ value=”NA” checked tabindex=”20″> N/A
<input type=”checkbox” name=”chkTCNA1″ value=”NA” checked tabindex=”28″> N/A
<button name=”cmdClearOne” value=”” type=”button” onclick=”ClearFields(‘EstimateRequest’, ‘txtFlatFinishedSize1,grpCover1[2],chkTCNA1’, ‘value,checked,checked’, ‘,true,true’, ‘Are you sure you want to clear all of Item One?’)”>Clear</button>
</form>
Javascript Code:
[CODE]
function ClearFields(strForm,strFields,strTypes,strValues,strMessage){
if(strMessage!=””){
var ClearMessage = confirm(strMessage);
}
if(ClearMessage==true||strMessage==””){
var x = document.forms[strForm];
var strFieldsArray = strFields.split(“,”);
var strTypesArray = strTypes.split(“,”);
var strValuesArray = strValues.split(“,”);
for(i in strFieldsArray){
x[strFieldsArray[i]][strTypesArray[i]] = strValuesArray[i];
}
}
}