ASP.NET
-
In my ASP+ page, I have three radio buttons for 'Vacaction', 'Paid Absence', and 'Other'. Next to the 'Other' radio button is a TextBox, where the user is supposed to specify what the 'Other' reason is for requesting time off. Following the TextBox, I have a CustomValidator WebControl that calls a ClientValidationFunction that, at this time, simply has the line 'alert("Hello");'. My problem is that right now, the function only gets called if I enter text in to the field. What I want to have happen is that anytime the 'Other' radio button is checked, if the TextBox is empty, then the validator should flag, and the error message should become visible. Here is the relevant code:
<asp:radiobutton id="optVacation" text="Vacation" checked="true" groupname="AttendanceType" runat=server/>
<asp:radiobutton id="optPaidAbsence" text="Paid Absence" groupname="AttendanceType" runat=server/>
<asp:radiobutton id="optOther" text="Other (Specify)" groupname="AttendanceType" runat=server/>
<asp:textbox id="txtOther" class="TextBox" width="300" runat=server/><asp:customvalidator id="OtherValidator" ClientValidationFunction="IsOtherFilled" ControlToValidate="txtOther" display="static" runat=server>Please specify Attendance (Other)</asp:customvalidator>And the function:
function IsOtherFilled(source, value)
{
alert("Hello"); //This is only called if txtOther has text in it, but should be called regardless
}Thanks in advance for any help that you may be able to provide. Jamie Nordmeyer Portland, Oregon, USA