Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Resolve my problem using commandButton.</p> <pre><code>&lt;h:form&gt; &lt;p:panel id="account"&gt; &lt;h:panelGrid columns="2" columnClasses="column" cellpadding="5"&gt; &lt;h:outputText value="Balance: " /&gt; &lt;p:inplace editor="true"&gt; &lt;p:ajax event="save" onsuccess="saveAccount.enable();"/&gt; &lt;p:inputText value="#{accountManagedBean.account.balance}" required="true"/&gt; &lt;/p:inplace&gt; &lt;h:outputText value="Credit limit: " /&gt; &lt;p:inplace editor="true" &gt; &lt;p:ajax event="save" onsuccess="saveAccount.enable();"/&gt; &lt;p:inputText value="#{accountManagedBean.account.creditLimit}" required="true"/&gt; &lt;/p:inplace&gt; &lt;h:outputText value="Comment: " /&gt; &lt;p:inplace editor="true"&gt; &lt;p:ajax event="save" onsuccess="saveAccount.enable();"/&gt; &lt;p:inputText value="#{accountManagedBean.account.comment}"/&gt; &lt;/p:inplace&gt; &lt;p:commandButton title="Save account changes" value="Save" widgetVar="saveAccount" action="#{accountManagedBean.saveAccount}" oncomplete="saveAccount.disable();" /&gt; &lt;/h:panelGrid&gt; &lt;/p:panel&gt; &lt;script type="text/javascript"&gt;$(document).ready(function() {saveAccount.disable();});&lt;/script&gt; &lt;/h:form&gt; </code></pre> <p>Small changes in managed bean:</p> <pre><code> public void saveAccount() { accountController.update(account); // extract info for page // extractAccount(); } </code></pre> <p>Explenation. I create commandButton with title "Save", which is disable when page is loaded. After editing one or more account values on page the button is enabled by code:</p> <pre><code>&lt;p:ajax event="save" onsuccess="saveAccount.enable();"/&gt; </code></pre> <p>After pushing "save" button it is disabled - i use attribute oncomplete:</p> <pre><code>oncomplete="saveAccount.disable();" </code></pre> <p>There were <a href="http://forum.primefaces.org/viewtopic.php?f=3&amp;t=17129" rel="nofollow">problems with commandButton attribute disable</a>, so I simple jQuery code, which make button disabled aftet loading page:</p> <pre><code>&lt;script type="text/javascript"&gt;$(document).ready(function() {saveAccount.disable();});&lt;/script&gt; </code></pre> <p>But the question about problem with saving inline values to DB is still actual.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload