Wednesday, 15 May 2013

jsp - Disabling Radio button doesnt work correctly -



jsp - Disabling Radio button doesnt work correctly -

i having issues using disable attribute radio buttons. in code based on when statement need preselect radio button , disable user cant alter it. code works fine on front end end when submit form db value button becomes null.

<c:when test="${data_warehouse != null && data_warehouse == 'cns' && data_warehouse_response != null && data_warehouse_response == 'cns_0'}"> <label for="rmailer" class="radio-wrap"> <input type="radio" name="maileraddressee" value="mai" id="rmailer" checked disabled> mailer </label> <label for="raddressee" class="radio-wrap"> <input type="radio" name="maileraddressee" value="add" id="raddressee" disabled> addressee </label> <input name="maileraddressee" value="mai" type="hidden"/> </c:when>

you don't need disable checked radio button. if other radio buttons in grouping disabled, user won't able uncheck 1 checked when page loaded.

<label for="rmailer" class="radio-wrap"> <input type="radio" name="maileraddressee" value="mai" id="rmailer" checked="checked"> mailer </label> <label for="raddressee" class="radio-wrap"> <input type="radio" name="maileraddressee" value="add" id="raddressee" disabled="disabled"> addressee </label>

if submit form now, should value of mai maileraddressee.

jsp radio-button

No comments:

Post a Comment