gagnonmv
asked on
Turn RequiredFieldValidators Enable/Disable If TextBox Empty
I have a web form that works well but I need to turn on/off requiredfiledvalidator depending on if certain textboxes have been completed or are empty.
I need an example of JavaScript using the following example: Also where is this code placed? On the aspx page, aspx.vb page or on the function.vb page.
If TextBox1 empty then require TextBox2, TextBox3 requiredfieldvalidator enabled else........
Thanks
I need an example of JavaScript using the following example: Also where is this code placed? On the aspx page, aspx.vb page or on the function.vb page.
If TextBox1 empty then require TextBox2, TextBox3 requiredfieldvalidator enabled else........
Thanks
ASKER
Here's what I have so can you give me an example:
So If Job_Number Empty then Enable Required Field Fund:
Thanks
So If Job_Number Empty then Enable Required Field Fund:
Thanks
<td valign="top" style="width: 173px">
<asp:RegularExpressionValidator ID="RegularExpressionValidator12" runat="server" validationexpression="^[A-Z0-9\s]{8,8}$" ErrorMessage="Enter Letters in UPPER Case and the entry must be 8 Characters in Length." ControlToValidate="JOB_NUMBER" Display="Dynamic" CssClass="error"></asp:RegularExpressionValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator15" Enabled="false" runat="server" ErrorMessage="Required Entry" ControlToValidate="JOB_NUMBER" Display="Dynamic" CssClass="error" Font-Size="Small" />
<asp:TextBox ID="Job_Number" MaxLength="8" runat="server" ToolTip="Enter the Eight (8) Character Job Code. Example IDP40108."></asp:TextBox></td>
<td valign="top" style="width: 173px">
<asp:RegularExpressionValidator ID="RegularExpressionValidator14" runat="server" validationexpression="^[A-Z0-9\s]{4,4}$" ErrorMessage="Enter Letters in UPPER Case and the entry must be 4 Characters in Length." ControlToValidate="FUND" Display="Dynamic" CssClass="error"></asp:RegularExpressionValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator17" Enabled="false" runat="server" ErrorMessage="Required Entry" ControlToValidate="FUND" Display="Dynamic" CssClass="error" Font-Size="Small" />
<asp:TextBox ID="Fund" MaxLength="4" runat="server" ToolTip="Enter the Four (4) Character Fund. Example: CNCN"></asp:TextBox></td>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You cannot delete a question when you don't respond to expert comments.
ASKER
Okay, but you provided me with no examples and no answer. Basically you told me to find the answer myself.
You can place the javascript anywhere in the page, and use the ClientValidationFunction property to specify the function name.