9 Replies Latest reply on Feb 17, 2011 9:14 PM by bhiles

    inplaceInput Events (RichFaces 4.0)

    bhiles

      What events are raised from rich:inplaceInput? I'm trying to tie ajax events to the "save" functionality and the events from pre 4.0 are not there (i.e. onviewactivated).

       

      Thanks.

        • 1. Re: inplaceInput Events (RichFaces 4.0)
          bhiles

          Let me ask this a slightly different way. If I want to use rich:inplaceInput, and when the user is done with editing the field and they click the button that is the green check mark by default, how do I get that to submit the form and save the field?

           

          Thanks.

          • 2. Re: inplaceInput Events (RichFaces 4.0)
            ilya40umov

            This is the inplaceInput tag definition from rich.taglib.xml of M4:

             

                <tag>
                    <tag-name>inplaceInput</tag-name>
                    <component>
                        <description>@author Anton Belevich</description>
                        <component-type>org.richfaces.InplaceInput</component-type>
                        <renderer-type>org.richfaces.InplaceInputRenderer</renderer-type>
                    </component>
                    <attribute>
                        <description>The value binding expression used to wire up this component to a component property of a JavaBean class</description>
                        <icon />
                        <name>binding</name>
                        <type>javax.faces.component.UIComponent</type>
                    </attribute>
                    <attribute>
                        <name>changedStateClass</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <description>Converter instance registered with this component.</description>
                        <display-name>Converter</display-name>
                        <icon />
                        <name>converter</name>
                        <type>javax.faces.convert.Converter</type>
                    </attribute>
                    <attribute>
                        <description>A ValueExpression enabled attribute that, if present, will be used as the text of the converter message, replacing any message that comes from the converter.</description>
                        <display-name>Converter Message</display-name>
                        <icon />
                        <name>converterMessage</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>defaultLabel</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>disableStateClass</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>editClass</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>editEvent</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>editStateClass</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <description>The component identifier for this component. This value must be unique within the closest parent component that is a naming container.</description>
                        <display-name>Component Identifier</display-name>
                        <icon />
                        <name>id</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <description>Flag indicating that this component's value must be converted and validated immediately (that is, during Apply Request Values phase), rather than waiting until Process Validations phase.</description>
                        <display-name>Immediate Action</display-name>
                        <icon />
                        <name>immediate</name>
                        <type>boolean</type>
                    </attribute>
                    <attribute>
                        <name>inputWidth</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>noneClass</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>onblur</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>onclick</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>ondblclick</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>onfocus</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>oninputblur</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>oninputchange</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>oninputclick</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>oninputdblclick</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>oninputfocus</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>oninputkeydown</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>oninputkeypress</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>oninputkeypup</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>oninputmousedown</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>oninputmousemove</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>oninputmouseout</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>oninputmouseover</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>oninputmouseup</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>oninputselect</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>onkeydown</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>onkeypress</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>onkeypup</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>onmousedown</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>onmousemove</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>onmouseout</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>onmouseover</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>onmouseup</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>readyStateClass</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <description>Flag indicating whether or not this component should be rendered (during Render Response Phase), or processed on any subsequent form submit. The default value for this property is true.</description>
                        <display-name>Rendered Flag</display-name>
                        <icon />
                        <name>rendered</name>
                        <type>boolean</type>
                    </attribute>
                    <attribute>
                        <description>Flag indicating that the user is required to provide a submitted value for this input component.</description>
                        <display-name>Required Flag</display-name>
                        <icon />
                        <name>required</name>
                        <type>boolean</type>
                    </attribute>
                    <attribute>
                        <description>A ValueExpression enabled attribute that, if present, will be used as the text of the validation message for the "required" facility, if the "required" facility is used.</description>
                        <display-name>Required Message</display-name>
                        <icon />
                        <name>requiredMessage</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <name>saveOnBlur</name>
                        <type>boolean</type>
                    </attribute>
                    <attribute>
                        <name>showControls</name>
                        <type>boolean</type>
                    </attribute>
                    <attribute>
                        <name>state</name>
                        <type>org.richfaces.component.InplaceState</type>
                    </attribute>
                    <attribute>
                        <name>tabIndex</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <description>MethodExpression representing a validator method that will be called during Process Validations to perform correctness checks on the value of this component. The expression must evaluate to a public method that takes FacesContext, UIComponent, and Object parameters, with a return type of void.</description>
                        <display-name>Validator</display-name>
                        <icon />
                        <name>validator</name>
                        <type>javax.faces.el.MethodBinding</type>
                    </attribute>
                    <attribute>
                        <description>A ValueExpression enabled attribute that, if present, will be used as the text of the validator message, replacing any message that comes from the validator.</description>
                        <display-name>Validator Message</display-name>
                        <icon />
                        <name>validatorMessage</name>
                        <type>java.lang.String</type>
                    </attribute>
                    <attribute>
                        <description>The current value of this component.</description>
                        <display-name>Value</display-name>
                        <icon />
                        <name>value</name>
                        <type>java.lang.Object</type>
                    </attribute>
                    <attribute>
                        <description>&lt;p&gt; MethodExpression representing a value change listener method that will be notified when a new value has been set for this input component. The expression must evaluate to a public method that takes a &lt;code&gt;ValueChangeEvent&lt;/code&gt; parameter, with a return type of void, &lt;span class="changed_added_2_0"&gt;or to a public method that takes no arguments with a return type of void. In the latter case, the method has no way of easily knowing what the new value is, but this can be useful in cases where a notification is needed that "this value changed".&lt;/span&gt; &lt;/p&gt;</description>
                        <display-name>Value Change Listener</display-name>
                        <icon />
                        <name>valueChangeListener</name>
                        <type>javax.faces.el.MethodBinding</type>
                    </attribute>
                </tag>

                <tag>

                    <tag-name>inplaceInput</tag-name>

                    <component>

                        <description>@author Anton Belevich</description>

                        <component-type>org.richfaces.InplaceInput</component-type>

                        <renderer-type>org.richfaces.InplaceInputRenderer</renderer-type>

                    </component>

                    <attribute>

                        <description>The value binding expression used to wire up this component to a component property of a JavaBean class</description>

                        <icon />

                        <name>binding</name>

                        <type>javax.faces.component.UIComponent</type>

                    </attribute>

                    <attribute>

                        <name>changedStateClass</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <description>Converter instance registered with this component.</description>

                        <display-name>Converter</display-name>

                        <icon />

                        <name>converter</name>

                        <type>javax.faces.convert.Converter</type>

                    </attribute>

                    <attribute>

                        <description>A ValueExpression enabled attribute that, if present, will be used as the text of the converter message, replacing any message that comes from the converter.</description>

                        <display-name>Converter Message</display-name>

                        <icon />

                        <name>converterMessage</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>defaultLabel</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>disableStateClass</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>editClass</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>editEvent</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>editStateClass</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <description>The component identifier for this component. This value must be unique within the closest parent component that is a naming container.</description>

                        <display-name>Component Identifier</display-name>

                        <icon />

                        <name>id</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <description>Flag indicating that this component's value must be converted and validated immediately (that is, during Apply Request Values phase), rather than waiting until Process Validations phase.</description>

                        <display-name>Immediate Action</display-name>

                        <icon />

                        <name>immediate</name>

                        <type>boolean</type>

                    </attribute>

                    <attribute>

                        <name>inputWidth</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>noneClass</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>onblur</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>onclick</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>ondblclick</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>onfocus</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>oninputblur</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>oninputchange</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>oninputclick</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>oninputdblclick</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>oninputfocus</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>oninputkeydown</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>oninputkeypress</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>oninputkeypup</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>oninputmousedown</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>oninputmousemove</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>oninputmouseout</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>oninputmouseover</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>oninputmouseup</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>oninputselect</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>onkeydown</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>onkeypress</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>onkeypup</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>onmousedown</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>onmousemove</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>onmouseout</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>onmouseover</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>onmouseup</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>readyStateClass</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <description>Flag indicating whether or not this component should be rendered (during Render Response Phase), or processed on any subsequent form submit. The default value for this property is true.</description>

                        <display-name>Rendered Flag</display-name>

                        <icon />

                        <name>rendered</name>

                        <type>boolean</type>

                    </attribute>

                    <attribute>

                        <description>Flag indicating that the user is required to provide a submitted value for this input component.</description>

                        <display-name>Required Flag</display-name>

                        <icon />

                        <name>required</name>

                        <type>boolean</type>

                    </attribute>

                    <attribute>

                        <description>A ValueExpression enabled attribute that, if present, will be used as the text of the validation message for the "required" facility, if the "required" facility is used.</description>

                        <display-name>Required Message</display-name>

                        <icon />

                        <name>requiredMessage</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <name>saveOnBlur</name>

                        <type>boolean</type>

                    </attribute>

                    <attribute>

                        <name>showControls</name>

                        <type>boolean</type>

                    </attribute>

                    <attribute>

                        <name>state</name>

                        <type>org.richfaces.component.InplaceState</type>

                    </attribute>

                    <attribute>

                        <name>tabIndex</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <description>MethodExpression representing a validator method that will be called during Process Validations to perform correctness checks on the value of this component. The expression must evaluate to a public method that takes FacesContext, UIComponent, and Object parameters, with a return type of void.</description>

                        <display-name>Validator</display-name>

                        <icon />

                        <name>validator</name>

                        <type>javax.faces.el.MethodBinding</type>

                    </attribute>

                    <attribute>

                        <description>A ValueExpression enabled attribute that, if present, will be used as the text of the validator message, replacing any message that comes from the validator.</description>

                        <display-name>Validator Message</display-name>

                        <icon />

                        <name>validatorMessage</name>

                        <type>java.lang.String</type>

                    </attribute>

                    <attribute>

                        <description>The current value of this component.</description>

                        <display-name>Value</display-name>

                        <icon />

                        <name>value</name>

                        <type>java.lang.Object</type>

                    </attribute>

                    <attribute>

                        <description>&lt;p&gt; MethodExpression representing a value change listener method that will be notified when a new value has been set for this input component. The expression must evaluate to a public method that takes a &lt;code&gt;ValueChangeEvent&lt;/code&gt; parameter, with a return type of void, &lt;span class="changed_added_2_0"&gt;or to a public method that takes no arguments with a return type of void. In the latter case, the method has no way of easily knowing what the new value is, but this can be useful in cases where a notification is needed that "this value changed".&lt;/span&gt; &lt;/p&gt;</description>

                        <display-name>Value Change Listener</display-name>

                        <icon />

                        <name>valueChangeListener</name>

                        <type>javax.faces.el.MethodBinding</type>

                    </attribute>

                </tag>

             

            You can use valueChangeListener to save a new value, or some js events like oninputchange to submit the form

            • 3. Re: inplaceInput Events (RichFaces 4.0)
              jbalunas

              You can also just use a4j:ajax like any other input component, but have it fire on inputchange.

               

              -Jay

              • 4. Re: inplaceInput Events (RichFaces 4.0)
                bhiles

                I get an error that inputchange is not an event for UIInplaceInput. If I have it be change (like what f:ajax would use, I'm not getting my listener to fire.

                 

                This seems like it would be something that people would do all the time, but I'm not finding anything on it.

                 

                It seems like inplaceInput is not set up for ajax usage. using showControls="true" seems like an excellent candidate to utilize ajax to submit the form and save the value to the backend. The only examples I've found so far of using inplaceInput are somewhat trivial replacement for standard inputText fields (which I can get to work ajax style).

                 

                -Brian

                • 5. Re: inplaceInput Events (RichFaces 4.0)
                  ilya_shaikovsky

                  use a4j:ajax with just event="change". We missed that event to be implemented properly in 3.3.x so you had to use that onviewactivated with custom checks if the value was actually changed(in other case even cancel caused request).

                   

                  In that version we implemented onchange properly so it should be more proper way to handle all change events (either by controls or by input change).

                  • 6. Re: inplaceInput Events (RichFaces 4.0)
                    bhiles

                    That's kinda what I already had implemented, but the a4j:ajax event is not triggering my listener. Here's my code.

                     

                                <h:form>

                                    <rich:inplaceInput showControls="true" id="seriesName" value="#{seriesViewBean.series.name}">

                                        <a4j:ajax event="change" render="nameError" listener="#{seriesViewBean.updateListener}"/>

                                    </rich:inplaceInput>

                                    <h:message id="nameError" for="seriesName" />

                                </h:form>

                    And my bean's listener method:

                        public void updateListener(AjaxBehaviorEvent event) {

                            series = seriesService.update(series);

                        }

                     

                    This code works when just a straight <h:inputText> my listener gets called and the value gets persisted. When it is changed to a <rich:inplaceInput> nothing happens.

                     

                    Also, the <a4j:ajax> does not have event defined in a way that Netbeans recognizes.

                     

                    Thanks for your help!

                     

                    -Brian

                    • 7. inplaceInput Events (RichFaces 4.0)
                      shyamk

                      Hey Brian,

                       

                      I am having the same problem. Were you able to get ajax event working with inplace input?

                       

                      Thanks,

                      Shyam

                      • 8. Re: inplaceInput Events (RichFaces 4.0)
                        bhiles

                        No I haven't. Using a f:ajax, I can't get any of the events to fire my listener. I'm also having the same problem with the Richfaces calendar component. It's like none of the events have been implemeneted to have the JSF Facelets ajax event tags trigger anything.

                        • 9. Re: inplaceInput Events (RichFaces 4.0)
                          bhiles

                          Progress, but not solved!!!

                           

                          Just pulled in M6 and the change event works now for the render items. Listeners still do not work. Here's my code.

                           

                          --------From my view------------------------------

                                          <rich:inplaceInput id="lineName" value="#{lineViewBean.line.name}">

                                              <f:ajax event="change" render="nameError msgs :headerValue" listener="#{lineViewBean.updateListener}"/>

                                          </rich:inplaceInput>

                           

                          ---------From my backing bean ----------------

                              public void updateListener (AjaxBehaviorEvent event){

                                  line = lineService.update(line);

                              }

                           

                          Now.... Everything works when I use <h:inputText in place of <rich:inplaceInput. The listener does not get invoked when using the rich component. Anyone else having this? Can verify this? Should a bug be filed?

                           

                          Thanks everyone!!!