Hello Everyone,
Anyone has any idea how to hide the panel depends on the value of radio field or dropdown field? Mine wasn`t working, this is what I want to achieve if you select the commercial radio field a certain panel will hide.
First I created a Custom.tpl in my Account Module. Check my codes below
<script>
{literal}
//Account Type
var radioChange = "input[name='customer_classification_c']";
YAHOO.util.Event.onDOMReady(function () {
disabledAccountType();
YAHOO.util.Event.addListener(YAHOO.util.Selector.query(radioChange), "change", function () {
disabledAccountType();
});
function disabledAccountType() {
if ($('input[name="customer_classification_c"]:checked').val() == 'Commercial') {
$('#customer_classification_type').attr('disabled',false);
$('#name').attr('disabled',false);
$('#first_name').attr('required',false);
$('#middle_name').attr('required',false);
$('#last_name').attr('required',false);
$('#lbl_editview_panel5').hide();
} else {
$('#customer_classification_type').attr('disabled',true);
$('#name').attr('disabled',true);
$('#first_name').attr('required',true);
$('#middle_name').attr('required',true);
$('#last_name').attr('required',true);
$('#lbl_editview_panel5').show();
}
}
});
{/literal}
</script>
Additional: It is possible also to remove the require attribute of the First Name, Middle Name and Last Name if the whole panel is hidden. By the way in vardefs I set those three fields as required.