Sorry if this has already been answered but I can't find any answers or examples that work exactly as I need them to.
I have a JSF (2.0) page where the user is given a code (like a captcha) and has to enter that exact code in an inputText field. I would like to disable (or, even better, to hide) that inputText field as soon as the user has entered the code correctly (and the focus is still on the inputText field).
This works:
<h:inputText id="code" value="#{myBean.code}">
<f:ajax event="keyup" render="code" />
</h:inputText>
but on every keyup the inputText field loses focus, so that solution is not acceptable. I've also tried setting readonly="true" (using a backing bean boolean) but it is not setting the inputText's readonly attribute to true even though it is setting the corresponding backing bean's corresponding boolean value to true:
<h:inputText id="code" value="#{myBean.code}" readonly="#{myBean.hasCodeBeenMatched}">
<f:ajax event="keyup" />
</h:inputText>
Any help is greatly appreciated!