DEMO : Validation of Listbox on submit of a Form

Submit the form by clicking the button.

Return to Listbox validation


<script type="text/javascript">
function data_check()
var str=document.getElementById("l1").value;
if(str.length <=0){
document.getElementById('my_msg').innerHTML=" Select One option before submitting ";
return false;
document.forms['drop_list'].submit();// Submit the form}


<form name="drop_list" action="listbox-validation-demock.php" method="post" id='f1'>
<select name="Category" id="l1">
<option value=''>Select One</option>
<option value="PHP">PHP</option>
<option value="ASP">ASP</option>
<option value="JavaScript">JavaScript</option>
<option value="HTML with design">HTML</option>
<option value="Perl">Perl</option><option value="MySQL">MySQL</option></select>
<div id='my_msg'>Submit the form by clicking the button.</div>
<input onclick="data_check()"; value="Submit Form" type="button"> 


Listbox Validation
Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer