私は市場アプリケーションを持っています。支払いページにh:formは、フィールドにいくつかの検証が含まれています。フォームをh:commandButton送信し、バックエンドでアクションを実行する必要があります。
コードは次のとおりです。
<div class="form-actions">
<h:commandButton onclick="setTimeout($('#adios').modal('show'),50)"
value="Pay!" action="#{basketManager.pay(accountManager.currentAccount.username)}"
class="btn btn-primary btn-lg"/>
</div>
modalメッセージを表示するだけです。しかし、h:form検証が正しく満たされた後、またはさらに良いことに、action内部の後にこのアクションを実行する必要がありますh:commandButton(ちなみに、これは機能しません。削除した場合にのみ機能しますonClick)
何か案は?
編集: @SRy のアドバイスに感謝しますが、まだ問題があります。これは私のコードです:
<div class="form-actions">
<p:commandButton oncomplete="$('#adios').modal('show')"
value="Pay!" action="#{basketManager.pay(accountManager.currentAccount.username)}"
styleClass="btn btn-primary btn-lg"/>
</div>