Skip to content Skip to sidebar Skip to footer

Submit With Checkbox? No Javascript

Is there any way to submit a form when a user clicks on a checkbox? Think of a todo list. When the user clicks on the checkbox, it updates the todo entry in the database saying its

Solution 1:

You could use an image as a submit button:

<input type="image" name="done_5" src="checkbox_unchecked.gif" border="0">

That image would be an unchecked image of course, then reload with a checked version This button would follow the normal form action attribute


Solution 2:

Sorry.. without Javascript the answer is no. :-)

You may want to consider using AJAX form submission for something like that for user experience sake. At any rate the Javascript would look like this:

function submitForm() {
    document.myform.submit();
}

then use an OnClick="submitForm();" or OnChange="submitForm();"


Solution 3:

Can this be done without using JavaScript.

No.


Solution 4:

Use the "onclick" event on the checkbox to call the submit() function of the form in question.

In other words, "no" you need Javascript.


Solution 5:

Not without using JavaScript, no. It's fairly simple, though:

<input type="checkbox" onchange="this.form.submit();">

Post a Comment for "Submit With Checkbox? No Javascript"