How to click a submit button on an event

G

Gaijinco

I'm getting used to JavaScript once more.

I want to change the value of a textfield (which I know how to do it)
and then "press" a submit button to process the form, but I want to do
it when a user checks a check button.

Is there anything to do something like that?

Thanks.
 
P

Peter Michaux

I'm getting used to JavaScript once more.

I want to change the value of a textfield (which I know how to do it)
and then "press" a submit button to process the form, but I want to do
it when a user checks a check button.

Is there anything to do something like that?

Thanks.

Sounds like you want to synthetically generate an event. I don't
recommend doing it that way.

You could do something like this...

<script type="text/javascript">
function submitform() {
var form = document.forms.myForm;
// do stuff with form here
form.submit();
}
</script>

<form action="" name="myForm">
<p><input type="checkbox" name="some_name" value=""
onclick="submitform();"></p>
<p><input type="submit" value="submitform();return false;"></p>
</form>

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,160
Messages
2,570,890
Members
47,423
Latest member
henerygril

Latest Threads

Top