Hi folks!
I have a problem involving validation and submit listeners.
Here is the (simplified) HTML template:
<form jwcid="@Form"
listener="ognl:listeners.onChangeEventPropertySelectionListener"
delegate="bean:delegate">
<select jwcid="[EMAIL PROTECTED]" id="countrySelect"
value="ognl:country" model="ognl:countriesModel"
onChange="this.form.submit()"/>
<span jwcid="@FieldLabel" field="component:pickupDatePicker"/></span>
<span jwcid="pickupDatePicker"/>
<input type="submit" listener="ognl:listeners.searchSubmitListener"
jwcid="@Submit" value="Search"/>
</form>
Here is the spec:
<component id="pickupDatePicker" type="DatePicker">
<binding name="validators" value="ognl:{beans.required,beans.maxDate}"/>
<binding name="value" value="ognl:pickupDate"/>
<binding name="displayName" value="literal:Pick up date"/>
</component>
<bean name="delegate" class="com.utils.MyValidationDelegate"
property="delegate"/>
<bean name="required" class="org.apache.tapestry.form.validator.Required"/>
<bean name="maxDate" class="org.apache.tapestry.form.validator.MaxDate">
<set name="maxDate" value="new java.util.Date()">
</set>
</bean>
And MyValidationDelegate is exactly (apart from the package name) the
class on
http://jakarta.apache.org/tapestry/UsersGuide/validation.html#validation.delegate
This code worked great until I wanted to support server-side validation.
As I understand, server-side validation is only possible with the
listener specified in the @Form component (and *not* with the one
specified in the @Submit component). But I was using the listener
belonging to the @Form for my onChange event of my @PropertySelection
component, and using the listener belonging to the @Submit for the
actual form submission.
Is there a simple way to have the form to be submitted with a specific
listener on my onChange event of my @PropertySelection, and also to have
my submit button calling the "regular" listener (the one specified in
the @Form component?
I tried to add a (hidden) @Submit component, which would be clicked via
JS on the onChange event of my @PropertySelection, but not only the
listener for that @Submit component is called, but *also* the listener
defined in the @Form component :(
Note: returning the same page in the first listener (associated with the
@Submit component) didn't work out, the other listener is also called!
I'm stuck.
/Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]