Click to See Complete Forum and Search --> : <select><option> question


mevasquez
02-14-2003, 12:49 PM
I want to be able to reset the option tag to option[0] in a select tag. Not too sure how to do this.

I have a validation set up when a user selects an option.selectedIndex an onChange event occurs and I do some validation. If the validation is false, I want to reset the option select to the default option.selectedIndex.

Any help would be appreciated.

Mike@spb

mevasquez
02-14-2003, 12:57 PM
Never mind. I figured it out with "document.form.reset()"

LAwebTek
02-14-2003, 01:02 PM
if it returns false:

/*rename form1 and select1 to the appropriate values*/
var SO = document.form1.select1.options
var i=0
SO[i].selected = true

mevasquez
02-14-2003, 01:10 PM
Thanks, that worked too.

LAwebTek
02-14-2003, 01:35 PM
You're quite welcome :D

var atFirst='developer.succeed=true'
if(eval(atFirst)){
celebrate()
} else {
tryAgain()
}