jsp tags - Selective Mandatory fields in a jsp -
jsp tags - Selective Mandatory fields in a jsp -
i have query jsp.
scenario: suppose have 2 fields
field one: connection type (selective dropdown) dropdown options: 1. gsm 2. cdma 3. others
field two: comments (free text)
question: how create mandatory user come in 'comments' free text box if 'connection type' selected 'others'
initially disable text area , when onchanging dropdown, selected value. if it's not empty, enable text box. in html
<select id="connectiontype" name="connectiontype" onchange="changetext()"> <option value="">select value</option> <option value="gsm">gsm</option> <option value="cdma">cdma</option> </select> <input type="text" id="comments" disabled="true" />
and in javascript,
function changetext() { if(document.getelementbyid("connectiontype").value !=""){ //alert(document.getelementbyid("connectiontype").value); document.getelementbyid("comments").disabled=false; }else{ document.getelementbyid("comments").disabled=true; } }
hope helps you.the demo in fiddle here
jsp jsp-tags
Comments
Post a Comment