Validate a Text Field of a Form That is Not to be Submitted

I have this web page coded in JSF.

In this page, I undertake some client side operations (they work properly) and therefore the "type" of my <h:commandButtion ...> is "button".

<h:commandButton type="button" value="Find" immediate="true"

onclick="filterTable_clickButton( 'genderTypes:filter', 'genderTypes:genderTable' )"/>

However, I want to test if a text field is left blank when the button is clicked. But the validation does not work.

<f:view>

<h:message for="filter" errorClass="errors"/>

<h:form id="genderTypes">

<h:inputText id="filter" required="true" />

.....

.....

I have a table with id="genderTable" here

.....

.....

<h:commandButton type="button" value="Find" immediate="true"

onclick="filterTable_clickButton( 'genderTypes:filter', 'genderTypes:genderTable' )"/>

</h:form>

</f:view>

What should I do?

[1347 byte] By [jiapei_jena] at [2007-11-27 8:19:33]
# 1
In this case you do not want to set immediate="true" on your button. That causes the validations to be skipped.
RaymondDeCampoa at 2007-7-12 20:07:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

But there is no response at all even after I removed

immediate="true"

<h:commandButton type="button" value="Find"

onclick="filterTable_clickButton( 'genderTypes:filter', 'genderTypes:genderTable' )"/>

jiapei_jena at 2007-7-12 20:07:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
you must've figured it out by now but the type should be "submit" and not "button".
kslma at 2007-7-12 20:07:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...