hai frinends
i am using hidden fields here but i cannot set validation for one field.
here is code
<head>
<script type="text/javascript">
// <![CDATA[
function display(obj,id1,id2,id3,id4) {
txt = obj.value;
document.getElementById(id1).style.display = 'none';
document.getElementById(id2).style.display = 'none';
document.getElementById(id3).style.display = 'none';
document.getElementById(id4).style.display = 'none';
if ( txt.match(id1) )
{
document.getElementById(id1).style.display = 'block';
}
if ( txt.match(id2) ) {
document.getElementById(id2).style.display = 'block';
}
if ( txt.match(id3) ) {
document.getElementById(id3).style.display = 'block';
}
if ( txt.match(id4) ) {
document.getElementById(id4).style.display = 'block';
}
}
// ]]>
</script>
</head>
<body>
<form name="form" method="POST">
<table>
<thead>
<tr>
<td class="field" cellpadding="2">
<input type="radio" name="radioBtn" id="indivi" value="indivi"
onclick="display(this,'indi','brok','buil','newp');"> Individual
<input type="radio" name="radioBtn" id="broker" value="broker"
onclick="display(this,'brok','buil','newp','indi');"> Broker
<!--<td class="title" cellspacing="2">Broker</td>-->
<input type="radio" name="radioBtn" id="builder" value="builder" onclick="display(this,'buil','newp','indi','brok');">Builder
<input type="radio" name="radioBtn" id="newpro" value="newpro"
onclick="display(this,'newp','indi','brok','buil');"> NewProject
</td>
<!--<td class="title">Builder</td>-->
</tr>
</thead>
<tfoot>
<tr>
<td class="align-center" colspan="2"><input type="submit" name="submit" value="Update" /></td>
</tr>
</tfoot>
</tbody>
<tbody id="indi" style="display: none;">
<tr></tr>
</tbody>
<tbody id="newp" style="display: none;">
<tr></tr>
</tbody>
<tbody id="brok" style="display: none;">
<tr>
<td class="title">Broker Name </td>
<td class="field"><input type="text" name="NumUsers" size="8" maxlength="7" /></td>
</tr>
<tr>
<td class="title">Broker's logo </td>
<td class="field"><input type="text" name="TotalUsers" size="10" /></td>
</tr>
<tr>
<td class="title"> Broker's URL </td>
<td class="field"><input type="text" name="Gtotal" size="8" maxlength="7" /></td>
</tr>
<tr>
<td class="title"> Broker profile </td>
<td class="field"><textarea name="broker_profile" ></textarea></td>
</tr>
</tbody>
<tbody id="buil" style="display: none;">
<tr>
<td class="title">Builder name </td>
<td class="field"><input type="text" name="TotalUsers" size="10" /></td>
</tr>
<tr>
<td class="title">Builder name </td>
<td class="field"><input type="text" name="optmods" size="5" /></td>
</tr>
<tr>
<td class="title"> Builder URL</td>
<td class="field"><input type="text" name="totaloptmods" size="5" /></td>
</tr>
<tr>
<td class="title"> Builder profile </td>
<td class="field"><textarea name="Builder _profile" ></textarea></td>
</tr>
</table>
</form>
</body>
</html>
this is the validation part
function countit(obj,msg)
{
formcontent=obj.value;
var len=formcontent.length;
if(len<5)
{
alert ("Please Enter minimum 500 characters in "+msg)
obj.focus()
return true
}
else
{return false}
}
///here only my problem starts
if(document.getElementById('brok'))
{
if(countit(document.form.broker_profile,document.getElementById('brok'),"Broker profile")){return false}
}
if(document.getElementById('buil'))
{
if(countit(document.form.builder_profile,"Builder profile")){return false}
}
//ends
please anybody help me i tried with id and name if anybody having sample script you are welcome
Thanks in advance
J.sivaani