Input field required based on select

Site: classic asp
Database: MSSQL

I have a form with a select and a hidden input as follows:

If select = x, the input is displayed and I want the input field required
if select <> x, the input will remain hidden and it can’t be required

Show and hide is working fine, just need help with validation only when the field is visible. Thanks!

@ben’s solution might help you out.

Thanks Scott, I have the show and hide function working fine, just need help with the validation


When you say validation, are you talking about the app connect side or the server action side?

Just want it required on the app connect side, if select = x, then I want them to be required to fill out the input. Does that make sense?

Ken, have you tried making the form elements disabled (in addition to hiding them) ?
I’m struggling myself with my first form validation implementation.
This seems to do the trick for me and client side validation seems to work fine.

(But I still get “required” errors on the server side.
EDIT : fixed, the “import” form feature put variables in POST but my form was configured with GET variables.)

Great Idea, i will try that. Thanks