Recent posts by Tim Wilson

Subscribe to Recent posts by Tim Wilson 2 posts found

Jun 18, 2007
Tim Wilson 2 posts

Topic: Script development / Add an onChange to a form

I got it. I found other posts talking about creating a function, calling that function, and inside that function simulate a click on a fake button. Here's what I came up with:

function mySubmit()
{
var b = document.createElement('button');
document.forms.namedItem('f').appendChild(b);
b.click();
}

sSelect.addEventListener("change", mySubmit, true);

 
Jun 18, 2007
Tim Wilson 2 posts

Topic: Script development / Add an onChange to a form

I am writing a script for a website that has a form with a submit button. The form contains only SELECT tags. I would like to add an onChange to one of the SELECT tags so when the user selects an option, they don't have to click submit. I've tried a couple of different things:
sSelect.onchange = submit;

And I've tried:
sSelect.addEventListener("change", submit, true);

The last one said submit didn't exist, so I tried sSelect.submit, but it still didn't work. Any ideas?