How can I make a textbox required if a checkbox is checked?
I figure I could write a custom validator, but I was hoping to avoid a full post back to check the valida
The JavaScript to handle this isn't very difficult.
Given the following ASP controls:
Add the following JavaScript function:
That's all there is to it. You will also want to add the following code to your Page Load event, so that if the user has JavaScript disabled, your required field validator is still turned on or off properly:
rfvSubject.Enabled = chkSubjectRequired.Checked