Camillia
asked on
Checking if one field is populated, the other 2 are as well
I think i need to use if-else for this but maybe there's a better way of doing this.
I have a fax number field...divided in 3 fields. Fax is NOT a required but still, i dont want users to enter something 999 99 (incomplete data).
How can i check that if , for example, area code is filled, the other 2 fields are also populated?
I do use a regularexpressionvalidtor to check for length of fields.
I have a fax number field...divided in 3 fields. Fax is NOT a required but still, i dont want users to enter something 999 99 (incomplete data).
How can i check that if , for example, area code is filled, the other 2 fields are also populated?
I do use a regularexpressionvalidtor to check for length of fields.
<tr>
<td width="137"><label for="fax">Fax number:</label></td>
<td width="310">
(<input type='text' name="fax1" id="fax1" runat="server" class='autotabindex' tabindex="11" maxlength="3" style='width:12%'/>)
<input type='text' name="fax2" id="fax2" runat="server" class='autotabindex' tabindex="12" maxlength="3" style='width:12%'/>
<input type='text' name="fax3" id="fax3" runat="server" class='autotabindex' tabindex="13" maxlength="4" style='width:20%'/>
</td>
<td width="280">
<span class="feedback">
<asp:RegularExpressionValidator ID="RegularExpressionValidator11" runat="server" ControlToValidate="fax1" ValidationExpression="^[0-9]{3}$" ErrorMessage="Invalid!" Text="Invalid!"></asp:RegularExpressionValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator12" runat="server" ControlToValidate="fax2" ValidationExpression="^[0-9]{3}$" ErrorMessage="Invalid!" Text="Invalid!"></asp:RegularExpressionValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator13" runat="server" ControlToValidate="fax3" ValidationExpression="^[0-9]{4}$" ErrorMessage="Invalid!" Text="Invalid!"></asp:RegularExpressionValidator>
</span>
</td>
</tr>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER