0
votes

I use JSF Mojarra 2.2.8 with PrimeFaces 5.1. For text input I use a primefaces editor and I want to upload the inserted text automatically with ajax.

The editor supports only an onchange event. Any suggestions how I can get a blur event working for an editor to reduce the request number? I tried this solution (Primefaces Editor and ajax submission on blur), but the event was never fired. Thanks.

<h:form>
      <p:editor widgetVar="documentation" onchange="submitDocumentation" />
      <p:remoteCommand name="submitDocumentation" process="@parent"
        update="@none" />
        <p:inputText></p:inputText>
    </h:form>
    
    <script type="text/javascript">
    $(document).ready(function() {
    	   //documentation is the editor widgetVar
    	   PF('documentation').jq.find("iframe").contents().find('body').blur(function(){
    		   alert("test");
    	      submitDocumentation();//remoteCommand
    	   });
    	});
    </script>
1

1 Answers

1
votes

I found the answer by myself:

$(document).ready(function() {
  PF('inputOverview').jq.find("iframe").contents().find('body').focusout(function() {
    alert('a');
    saveOverview();
  });
});