Problems with rich: implaceInput
helios2092 May 16, 2008 11:31 AMHello,
I'm trying to create a custom component for modifiable labels.
It consists of a rich:inplaceInput wich in every valueChangeEvent we change it associate value in the dataBase.
the source of the custom component
<ui:composition>
<c:if test="#{!empty sessionScope['edit']}">
<h:form id="#{id}form1">
<rich:inplaceInput id="#{id}Input" value="#{bundle[key]}" valueChangeListener="#{i18nBean.update}"
onchange="submit();">
<f:attribute name="key" value="#{key}"/>
<f:attribute name="bundleName" value="#{bundleName}"/>
</rich:inplaceInput>
</h:form>
</c:if>
<c:if test="#{empty sessionScope['edit']}">
<h:outputLabel id="#{id}Label" value="#{bundle[key]}">
<ui:insert/>
</h:outputLabel>
</c:if>
</ui:composition>
in every ValueChangeEvent we call the update method of managedBean:i18nBean
the source of the i18nBean
public class I18nBean {
private ILabelService labelService;
/**
*method which treat the ValueChangeEvent
*/
public void update(ValueChangeEvent event) {
// recuperate the 2 attributes :keys and bundle
FacesContext fc = FacesContext.getCurrentInstance();
String locale = fc.getExternalContext().getRequestLocale().toString();
UIComponent component = (UIComponent) event.getSource();
String key = (String) component.getAttributes().get("key");
String bundleName = (String) component.getAttributes().get("bundleName");
// updating the label in the data Base
if (ValidatorUtil.isNotBlank(key)) {
this.getLabelService().create(key, locale, event.getNewValue().toString());
}
ResourceBundle bundle = fc.getApplication().getResourceBundle(fc, bundleName);
if (bundle instanceof AbstractHibernateResourceBundle) {
AbstractHibernateResourceBundle hibernateResourceBundle = (AbstractHibernateResourceBundle) bundle;
hibernateResourceBundle.updateLabel(key, event.getNewValue().toString());
}
}
the test page:
head>
<title>Page de Test</title>
</head>
<body>
<h:panelGrid>
<h:form>
<h:commandLink value="Editer" actionListener="#{sessionBean.goEditMode}"/>
<h:commandLink value="Prévisualiser" actionListener="#{sessionBean.quitEditMode}"/>
</h:form>
<i18n:label id="label1" key="key4" bundle="#{kmji18n}" bundleName="kmji18n"/>
</h:panelGrid>
</body>
</html>
the problem is that it works fine in FF but not in IE7 in this one the form is never been submitted .
i spend a lot of time in this problem and i did not make any real progress.
Thanks in advance