Page 1 of 1

Access Error Messages through JS

Posted: Thu Feb 18, 2016 2:04 pm
by brianhd71
Is there a way to do this? I can change a property with the applyProperty() api but it looks like one extra level to use this property. I need to flip the error condition on. Right now I am using an alert() message but it would look a lot nicer if I can access the error message bubble.

if (repairDate > today || repairDate <= openDate){
alert("Invalid Date.")
pui.set("RepairDate", " ");
}

Re: Access Error Messages through JS

Posted: Thu Feb 18, 2016 2:47 pm
by Glenn
Brian,

I would normally suggest that you do this sort of validation on the server-side and use the 'error messages' property. Have you tried this solution and weren't happy with the way it worked, or would you just prefer this be done on the client-side?

Glenn

Re: Access Error Messages through JS

Posted: Thu Feb 18, 2016 3:40 pm
by Glenn
Brian,

Just in case you do, in fact, prefer to do the validation on the client-side we provide an API to show the error messages. It's called pui.errorTip(). You can find more info here: http://www.profoundlogic.com/docs/pages ... d=13664277

Glenn

Re: Access Error Messages through JS

Posted: Thu Feb 18, 2016 8:09 pm
by brianhd71
I'd prefer to do this on the back end too, but they want it on the UI. That api did the trick. Thanks!