Index: component/src/com/icesoft/faces/component/selectinputdate/SelectInputDateRenderer.java =================================================================== --- component/src/com/icesoft/faces/component/selectinputdate/SelectInputDateRenderer.java (revision 85) +++ component/src/com/icesoft/faces/component/selectinputdate/SelectInputDateRenderer.java (working copy) @@ -212,6 +212,45 @@ return hiddenFieldName; } + protected String getCalendarButtonOnClickJS(FacesContext facesContext, + UIComponent uiComponent) { + UIComponent form = findForm(uiComponent); + String formId = form.getClientId(facesContext); + String clientId = uiComponent.getClientId(facesContext); + String onClick = "document.forms['" + + formId + "']['" + + this.getLinkId(facesContext, uiComponent) + + "'].value='" + clientId + CALENDAR_BUTTON + + "';" + + "document.forms['" + + formId + "']['" + + getHiddenFieldName(facesContext, uiComponent) + + "'].value='toggle';" + + "iceSubmitPartial( document.forms['" + + formId + + "'], this,event);" + + "Ice.Calendar.addCloseListener('" + + clientId + "','" + formId + "','" + + this.getLinkId(facesContext, uiComponent) + "','" + + getHiddenFieldName(facesContext, uiComponent) + "');" + + "return false;"; + return onClick; + } + + protected String getPopupPositionAdjustmentJS(FacesContext facesContext, + UIComponent uiComponent) { + String clientId = uiComponent.getClientId(facesContext); + String javaScript = + "Ice.util.adjustMyPosition('" + + clientId + + CALENDAR_TABLE + + "', '" + + clientId + + ROOT_DIV + + "');"; + return javaScript; + } + /* (non-Javadoc) * @see com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer#encodeEnd(javax.faces.context.FacesContext, javax.faces.component.UIComponent) */ @@ -333,23 +372,7 @@ calendarButton.setAttribute(HTML.TYPE_ATTR, "image"); calendarButton.setAttribute(HTML.ONFOCUS_ATTR, "setFocus('');"); // render onclick to set value of hidden field to true - String onClick = "document.forms['" + - parentForm.getClientId(facesContext) + "']['" + - this.getLinkId(facesContext, uiComponent) + - "'].value='" + clientId + CALENDAR_BUTTON + - "';" - + "document.forms['" + - parentForm.getClientId(facesContext) + "']['" + - getHiddenFieldName(facesContext, uiComponent) + - "'].value='toggle';" - + "iceSubmitPartial( document.forms['" + - parentForm.getClientId(facesContext) + - "'], this,event);" - + "Ice.Calendar.addCloseListener('" - + clientId + "','" + parentForm.getClientId(facesContext) + "','" - + this.getLinkId(facesContext, uiComponent) + "','" - + getHiddenFieldName(facesContext, uiComponent) + "');" - + "return false;"; + String onClick = getCalendarButtonOnClickJS(facesContext, uiComponent); calendarButton.setAttribute(HTML.ONCLICK_ATTR, onClick); if( selectInputDate.getTabindex() != null ){ try { @@ -375,7 +398,8 @@ facesContext, uiComponent)); String resolvedSrc; if (popupState) { - JavascriptContext.addJavascriptCall(facesContext, "Ice.util.adjustMyPosition('"+ clientId + CALENDAR_TABLE +"', '"+ clientId + ROOT_DIV +"');"); + String positionAdjustmentScript = getPopupPositionAdjustmentJS(facesContext, uiComponent); + JavascriptContext.addJavascriptCall(facesContext, positionAdjustmentScript); if (selectInputDate.isImageDirSet()) { resolvedSrc = CoreUtils.resolveResourceURL(facesContext, selectInputDate.getImageDir() + selectInputDate.getClosePopupImage());