Guest yakisir Posted May 26, 2006 Share Posted May 26, 2006 hi all,I am trying to make a field required if the radio button is selected as yes. I dont know how it is not doing it but here is my code below: if (trim(form.radio_trip.value) =='Y') && (dt_trip_start_date=='') { msg = "\n\t Trip Start Date"; ok = false; } if (!ok) alert(" The following fields are required: \n" + msg)I am trying to make the date field called "Trip Date" mandatory if radio button value is equal to 'Y'. I have used left trim also but did not work. I greatly appreciate if someone can assist me.Thanks. Link to comment Share on other sites More sharing options...
scott100 Posted May 26, 2006 Share Posted May 26, 2006 ok first off trim() is a vbscript function. if ((form.radio_trip.value=="Y") && (dt_trip_start_date=="")){ }else alert("The following fields are required: Trip Start Date") because there are 2 parts to the condition you must enclose it all in parenthesis.1 if statement with an else condition should do.try that. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now