If you have a Html (or Html5, JSP, PHP, ASP) page with a form element containing select option and you want to submit the form once a option is selected from the list of the dropdown then you can make use of javaScript.
Let's see how we can do that with an example, We have a text input type and a dropdown option with select options as : add, delete, and update. The user would enter a name and select one of the option to submit the form. We have no buttons. We do this using javaScript onchange event and submitting the form using this.form.submit()
File: dropdownexample.html<html>
<head>
<title>Submit form on Dropdown list select</title>
</head>
<body>
<form method="get">
Name : <input type="text" id="name" name="name" />
<br /><br />
Option :
<select onchange="this.form.submit()" id="option" name="option">
<option>Select Option</option>
<option>Add</option>
<option>Delete</option>
<option>Update</option>
</select>
</form>
</body>
</html>
More Posts related to JavaScript,
- Add Animated Scrolling to Html Page Title Script
- How to get query string in JavaScript HTML location.search
- How to get current URL Location using Javascript HTML
- How to detect Browser and Operating System Name and Version using JavaScript
- Submit html form on dropdown menu value selection or change using javascript
- How to Print from JavaScript HTML using window.print
- JavaScript : Get url protocol HTTP, HTTPS, FILE or FTP
- JavaScript : Get current page address
- How to send email from JavaScript HTML using mailto
- Send Extra Data with Ajax Get or Post Request
- Write javaScript code in Swedish using FikaScript
- Get Device Screen Width and Height using javaScript
- How to get UTC (GMT) using javascript
- Javascript convert text case from uppercase to lowercase
- Loading previous page using html button using JavaScript
- [javaScript] Convert text case to lowercase
- Detect if Cookies are enabled using JavaScript
More Posts:
- Force android app to run in Landscape mode programatically - Android
- Type R is already defined error : Android Error - Android
- Call PHP function on Button click using jquery ajax - PHP
- Can't Run SDK Manager find_java.bat issue - Android
- 10 FTP SFTP Clients and Alternatives - FTP
- auth_client_using_bad_version_title : Error Android Lint - Android
- Delete file using PHP code : unlink() - PHP
- Stop android adb service from command prompt or terminal - Android
- How to add Date and Time to Windows Notepad File - NotepadPlusPlus
- Mac OS X Taking Screen Capture using Terminal - Mac-OS-X
- Create SharePoint Site Collection using PowerShell New-SPSite - SharePoint
- SharePoint workflow Canceled - Coercion Failed: Unable to transform the input lookup data into the requested type - SharePoint
- Android : Prevent App for rotation landscape or portrait - Android
- MySQL 1005 Error : SQLSTATE: HY000 (ER_CANT_CREATE_TABLE) Message: Can't create table '%s' (errno: 150) - MySQL
- How to change Android EditText Cursor Color - Android