users@woodstock.java.net

Re: Asynchronous validation 4.1.1

From: Dmitry Kushner <Dmitry.Kushner_at_Sun.COM>
Date: Wed, 26 Mar 2008 18:34:24 -0600

Jason,

I do not believe message component has a client side renderer. Alert
does. That is why in order to render message, one has to do page submit.
But you can instantiate Alert on the client. Or you can hide it at
first, and display it on validation.


Jason Suplizio wrote:
> I have a textField, a label, and a button. When I click on the
> button, if the required text field is invalid (empty) I want the
> validation message (webuijsf:message) to be displayed as well as
> refresh the label and textField to be invalid - andI want to do this
> asynchronously. When the page is initially rendered assume it has no
> messages for the related text field component, therefore the message
> component doesn't get rendered unless I do a full page
> post/request/submit - which I am not allowed to do because of my
> requirements. My question is, how can I force render the message
> component to render so that I can display the validation error.
>
> Again, on the client I want to refresh the label, the text field, and
> the message to show that a required field is empty without posting
> (full page refresh) to the server.
>
> <webuijsf:message for="searchField" styleClass="errMessage"
> rendered="true" visible="true"/>
>
> <webuijsf:label id="searchFieldLabel"
> value="#{simpleSearchBean.prompt.inputLabel}:" for="searchField"/>
>
> <webuijsf:textField
> id="searchField"
> value="#{simpleSearchBean.prompt.value}"
> required="true"
> onKeyPress="return textFieldKeyPress(event);"/>
>
> <button class="Btn2_sun4 promptBtn" type="button"
> onclick="submitSearch();">#{rpMsg.go}</button>
>
> Any help would be greatly appreciated. Oh yeah,
> I've been calling searchField.refresh() and searchFieldLabel.setProps(
> {valid: false} ) but I can't get a handle on a non-existent message
> component.
>
> Jason