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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With