Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Submit form when selected value of select element is changed without javascript

Tags:

html

post

Hi the question is pretty simple.

<select name="justanumber">
    <option value="1" selected="selected">1</option>
    <option value="2"></option>
</select>

when selected value is changed i have to do a form post. But the problem is to do this WITHOUT javascript.

I'm not sure is it possible to do that, the best result i have archived is submit form using label for.

like image 824
Roman Kupin Avatar asked Jan 12 '11 17:01

Roman Kupin


People also ask

How can I submit a form without using JavaScript?

Use the <noscript></noscript> tags to define a "normal" submit-button when javascript is disabled. Show activity on this post. You could maybe use the <noscript> tag and encapsulate the above code with the button type as submit. If the client has js, the code inside the noscript will be ignored.

How do you submit a form to an event change?

Submit using JavaScriptDefine submitForm() function on change event of <select> . When it gets triggered then submit the form by calling submit() method and set an option selected using PHP according to the selected value.

How do you populate the options of a select element in JavaScript?

Projects In JavaScript & JQuery To populate select list with jQuery, use for loop along with append() and append the options to the already created select.


1 Answers

No, that is not possible without using client script.

I suggest that you use script for how you want it to work normally, and supply a submit button as a backup for those who can't use script.

like image 132
Guffa Avatar answered Oct 07 '22 01:10

Guffa