0

I'm using Bootsfaces, and I've a component defined like:

<b:commandButton type="button" styleClass="btn-sm"
   value="ACTION"
   update="idC1 idC2" onsuccess="something()"
    actionListener="#{myBean.myaction}" />

What I want is that myaction() force an Ajax error, in order to assure that something() is run

void myaction() {
if (condition) {
     success();
else 
     notsuccess();
}

As far as I can see validation errors dont cause ajax error. Right? Onsuccess script is run even if I throw a Faces validation exception. So it must exist another way.

Anybody can help me?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
rui
  • 79
  • 2
  • 7
  • 1
    Ok. Maybe it is that. How can i check for validation errors. I made an experience with Faces.validationfail(), but i couldn t check it in oncomplete.. – rui Mar 26 '20 at 00:21
  • Does this answer your question? [How to validate whether my form is valid from an oncomplete function in a b:commandButton?](https://stackoverflow.com/questions/53860939/how-to-validate-whether-my-form-is-valid-from-an-oncomplete-function-in-a-bcomm) – Jasper de Vries Mar 26 '20 at 09:14
  • Actually yes. Thank you very much. It solved one of my problems – rui Mar 27 '20 at 00:30
  • .. and https://stackoverflow.com/questions/14401652/how-to-trigger-args-validationfailed-in-primefaces-oncomplete – Jasper de Vries Mar 27 '20 at 11:20

0 Answers0