MarisP
MarisP

Reputation: 987

Setting field read-only depending on errors

I have few components- combo boxes, edit boxes and error messages.

What I'm trying to do is to make combo box read only if the error message (that is attached to the edit box) contains something.

I'm trying to use this in the "read-only" computed field:

getComponent("message3").value == ""

Apparently i'm doing something wrong and it throws error when I load the xpage. Any advice how to achieve the functionality I need?

Upvotes: 1

Views: 39

Answers (1)

Per Henrik Lausten
Per Henrik Lausten

Reputation: 21709

You can use the following to check for error messages:

facesContext.getMessages().hasNext()

Upvotes: 1

Related Questions