Forum Moderators: open
I was trying to Enable/Disable File text Property using radio button selected option by java script.
But i am gettint Error as ,
Getttin Error as document.forms.0.theFile is null or not an object
I am using Struts framework.
<code>
<tr>
<td width=50%>
<html:radio property="Result"
value="results from tool "
onclick="disableTextField()">Results from tool </html:radio>
</td>
<td width=50%>
<html:radio property="Result"
value="results from not tool"
onclick="enableTextField()">Results from non-existing tool </html:radio>
</td>
</tr>
<tr>
<td width=25%>
<b>Template File: </b><span class="warning">*</span>
</td>
<td width=75%>
<html:file property="theFile" disabled="true" />
</td>
</tr>
function enableTextField()
{
var form = document.forms[0];
alert("form"+form);
document.forms[0].theFile.disabled = "false";
}
function disableTextField()
{
var form = document.forms[0];
alert("form"+form);
document.forms[0].theFile.disabled = "true";
}
<code>
I am getting as,
Getttin Error as document.forms.0.theFile is null or not an object
If i click the Results from non-existing tool radio option it should enbale the theFile property ie.Browse button of Upload Template File.
If i should click on Results from tool it should disable the Browse button of Upload Template file.
Also,By default radio button with value "Results from tool" should be checked.
Can someone help me in this regard.
Thanks,
Srins.