views:

139

answers:

1

Hi,

I am using JSF validation to simply check that the length of a field is 15, if not an error message is shown. My issue with this approach is that user enters a number which is the correct length and clicks a button and some information is displayed about it. The second time when the user enters a number whose length is <15 then the validation error is shown BUT the information about the previous number remains on the screen. My trouble is I am not sure how to do a refresh of the page. I do the validation like this:

<h:inputText id="imei" value="#{imeiValidationHandler.imei}" required="true">
<f:validateLength minimum="15" maximum="15"/>
</h:inputText>

Any ideas much appreciated.

A: 

On your information section have a attribute that suppresses the display if the length of the imei is less than ideal. eg:

<h:outputText value="#{imeiInformation.value}" rendered="#{sometest}" />

You may also want to look into a4j and rich faces for using AJAX to render your page as things change on the client.

Martlark