@Override
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
FormUtil.throwEnclFormReqExceptionIfNeed(context, component);
super.doEncodeBegin(writer, context, component);
AbstractTogglePanel panel = (AbstractTogglePanel) component;
writer.startElement(HtmlConstants.INPUT_ELEM, component);
writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, getValueRequestParamName(context, component), null);
writer.writeAttribute(HtmlConstants.NAME_ATTRIBUTE, getValueRequestParamName(context, component), null);
writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.INPUT_TYPE_HIDDEN, null);
writer.writeAttribute(HtmlConstants.VALUE_ATTRIBUTE, panel.getActiveItem(), null);
writer.endElement(HtmlConstants.INPUT_ELEM);
writeJavaScript(writer, context, component);
}