-
1. Re: Where is declaration of EL invalid and EL required?
amitev Dec 13, 2009 9:10 PM (in response to xsalefter.xsalefter.yahoo.com)There code that sets #{invalid} and #{required} is inside org.jboss.seam.ui.renderkit.DecorateRendererBase. It sets the variable in the event scope. I'm not sure there is an easy and clean way to modify those values.
-
2. Re: Where is declaration of EL invalid and EL required?
xsalefter.xsalefter.yahoo.com Dec 13, 2009 10:05 PM (in response to xsalefter.xsalefter.yahoo.com)Thanks Adrian, you are right.
I'm not sure there is an easy and clean way to modify those values.Hmm.. I have a problem with it. I have RichFaces ModalPanel with jsf input, for example:
<rich:modalPanel id="mdp" width="500" height="170"> <f:facet name="header">Form Input Setting Akuntansi Detail</f:facet> <a:form id="fmdp"> <s:decorate id="dd1" template="/layout/edit.xhtml"> <ui:define name="label">Kode Akuntansi</ui:define> <h:inputText id="fmp1" required="true" size="40" maxlength="40" value="#{chartOfAccountHome.instance.code}"> <rich:suggestionbox width="300" for="fmp1" suggestionAction="#{chartOfAccountList.selectAllForComboBy}" var="_obj" fetchValue="#{_obj.code}"> <rich:column id="sbc1">#{_obj.code} - #{_obj.name}</rich:column> </rich:suggestionbox> </h:inputText> </s:decorate> <s:decorate id="dd2" template="/layout/edit.xhtml"> <ui:define name="label">Tipe Akun</ui:define> <h:selectOneMenu id="fmp2" required="true" value="#{transactionSettingDetailHome.instance.type}"> <f:selectItem itemValue="" itemLabel="- - - select - - -" /> <f:selectItems value="#{enumTypeFactory.accountTypesAsSelectItems}" /> </h:selectOneMenu> </s:decorate> <a:commandButton id="mdpbs" action="#{transactionSettingDetailHome.addDetail()}" value="Add" reRender="dd1, dd2, ttsdf, sb" oncomplete="if (#{facesContext.maximumSeverity.ordinal != 2}) Richfaces.hideModalPanel('mdp');" /> <a:commandButton type="reset" onclick="#{rich:component('mdp')}.hide();" id="mdbbc" value="Cancel" ajaxSingle="true" action="#{transactionSettingDetailHome.changeUIState(false)}" /> </a:form> </rich:modalPanel>
When I click
Add
button and the input field and the select menu is empty, the page show error messages. Then if I clickCancel
button, the modal panel is hidden.But, if I click other button which trigger the modal panel to showing up, the fields still have
error state
and display error message and decorate with .error class in the css.Can I avoid this problem? How? Because this is so confusing for end user (They probably ask: Why this error appear even I don't do anything?)
Thanks.
-
3. Re: Where is declaration of EL invalid and EL required?
xsalefter.xsalefter.yahoo.com Dec 15, 2009 5:39 AM (in response to xsalefter.xsalefter.yahoo.com)Hi.. I just try some work for this stuff and create some code like this:
public void invalidToDefaultValue(boolean invalid, boolean required) { log.info("Before set: #0, #1", Expressions.instance().createValueExpression("#{invalid}").getValue(), Expressions.instance().createValueExpression("#{required}").getValue()); Contexts.getEventContext().set("invalid", invalid); Contexts.getEventContext().set("required", required); log.info("After set: #0, #1", Expressions.instance().createValueExpression("#{invalid}").getValue(), Expressions.instance().createValueExpression("#{required}").getValue()); }
And this method invoked in form via a:commandButton, like:
<a:commandButton id="tes" type="reset" ajaxSingle="true" value="Reset" action="#{elRollBacker.invalidToDefaultValue(false, false)}" reRender="fts, d1, d2, f1, f2" />
And the result is, the log showing message:
INFO [ELRollBacker] Before set: null, null INFO [ELRollBacker] After set: false, false
And int the UI (browser) result, the message is dissapear, but the applied style like error style and the error image still showing an error. Can someone help me in this problem? Why the log showing null value? When I create code like:
Expressions.instance().createValueExpression("#{invalid}").getValue()
Why this is have a null value, but have a
true
value in the UI? And why the UI is not updated, even I trid to updated it via:reRender="fts, d1, d2, f1, f2"
in command button???
-
4. Re: Where is declaration of EL invalid and EL required?
lcbdl888 Jan 22, 2010 9:53 PM (in response to xsalefter.xsalefter.yahoo.com)I met the same issue, and ask the same question.