10 Replies Latest reply on Feb 1, 2012 3:16 PM by munna pintu

    Rich Editor

    munna pintu Newbie

      Hi,

      I was not able to capture an event to check some thing entered in rich editor or not, can you please help to do that.

       

      Thanks,

        • 1. Re: Rich Editor
          Lukáš Fryč Master

          Hi mannu,

           

          could you be more specific in what you are achieving?

          • 2. Re: Rich Editor
            munna pintu Newbie

            Hi Lukas,

             

            I have Rich Editor and want to caputre what ever user enters in it and before submitting the page to form  and want to warn user if he dont click save before closing the window.

             

            Thanks

            • 3. Re: Rich Editor
              Mahesh Bonagiri Newbie

              use required attribute

              • 4. Re: Rich Editor
                Brendan Healey Master

                I think you need to set a bean property from a <rich:editor valueChangeListener to indicate that the content has

                changed (TBH I've never used it, so this is guess work...). You should be able to get the content from the

                ValueChangeEvent parameter to the value change listener using getNewValue().

                • 5. Re: Rich Editor
                  iabughosh Master

                  hello munna,

                  try using this :

                  <rich:editor value="#{richBean.contents}">

                     <a4j:ajax event="change"/><!-- to save the value after previous focus-->

                     <a4j:ajax event="dirty"><!-- to save the value whenever user enters text-->

                      <a4j:attachQueue requestDelay="5000" ignoreDupResponses="true" /><!-- to prevent firing too much requests -->

                     </a4j:ajax>

                  </rich:editor>

                  • 6. Re: Rich Editor
                    munna pintu Newbie

                    Hi,

                    Thanks everyone, but nothing worked for me, I am using richfaces version 3.3.3, which i should have mentioned it earlier. any more help will be appreciated.

                     

                    Thanks

                    • 7. Re: Rich Editor
                      Christian Peter Expert

                      have you tried an <a4j:support event="onchange" ... ?

                       

                       

                      To detect the unload event of the current page, you'll have to add an eventlistener to the "onbeforeunload" event. But this one is quite tricky.

                      • 8. Re: Rich Editor
                        munna pintu Newbie

                        <rich:editor id="test" value="{user.data}" autoResize="true" width="250" height="100" theme="advanced" plugins="fullscreen" required="false">

                        <f:param name="theme_advanced_buttons1"

                                                                                                                                                                                                             value="undo,redo,removeformat,|,formatselect,styleselect,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,insertdate,inserttime,hr,outdent,indent," />

                                                                                                                                                                                        <f:param name="theme_advanced_buttons2" value="" />

                                                                                                                                                                                        <f:param name="theme_advanced_buttons3" value="" />

                                                                                                                                                                                        <f:param name="theme_advanced_toolbar_location" value="top" />

                                                                                                                                                                                        <f:param name="theme_advanced_toolbar_align" value="left" />

                         

                        <a4j:support  immediate="true" event="onkeyup" reRender="outputEnteredText" />

                        </rich:editor>

                         

                        <h:outputText id="outputEnteredText" value="Entered is:  #{user.data}" />

                         

                        i tried with onchange, onkeypress, onkeyup nothing worked, it will display the data when the page is refreshed but not during the event triggered.

                         

                        Thanks,

                        • 9. Re: Rich Editor
                          Christian Peter Expert

                          in my experience the onchange event of the RichEditor (RF3.3.3) is fired upon leaving the editor like clicking on the page elsewhere.

                           

                          Are you using the editor in a modal panel or just in your page?

                           

                          you should remove the "immediate="true"" from the a4j:support

                          • 10. Re: Rich Editor
                            munna pintu Newbie

                            i did removed immeidate = 'true' and i am not using it in modal panel. it feels like nothing is happening no event is fired at all.