Re: double validation with two different values for a text field

2011-02-04 Thread Pedro Santos
I guess you added an IValidator to the text field validating the input for
US zip before, both remove it from the component when this is not the
country being informed, or provide an IValidator aware of the
selected country, as your textfield already are: determining the converter
to be used based on selected country.

On Thu, Feb 3, 2011 at 8:24 PM, Doug Leeper douglee...@yahoo.com wrote:

 I have created a custom zip text field that validates against several
 country
 formats, i.e. US and Canada.  I have created specific country converters
 and
 validators that are utilized by this custom zip field.

 In my test scenario, I have a valid US address displayed.

 I then change the country that has a AjaxFormComponentUpdatingBehavior
 which
 sends back the zip and state fields.  Note: zip field has a model reference
 of
 the country value which determines which validator/converter to use.

 I change the zip to be a valid Canadian zip (A#A #A#) and submit the
 changes.

 In my debug statements, I see the new value is parsed and validated with no
 error detected.

 But what is interesting, the previous US zip value is also being validated
 which
 causes an unexpected.

 Where did this zip value come from?  Did I forget to change/refresh a
 value/component?

 Any help is much appreciated.

 Thanks
 - Doug




-- 
Pedro Henrique Oliveira dos Santos


Re: double validation with two different values for a text field

2011-02-04 Thread Doug Leeper

Found out the issue.  I was always returning a null value in my
converter.convertToObject().   When I returned the parsed value
correctly...everything worked fine.  With the null value, for some reason,
my underlying object model  did not set with a null value.  Very bizarre.

As far as removing validators...you can't.  I had to create a base validator
which was added to my ZipTextField and it was responsible for delegating to
correct country zip validator on the fly.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/double-validation-with-two-different-values-for-a-text-field-tp3259122p3260453.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



double validation with two different values for a text field

2011-02-03 Thread Doug Leeper
I have created a custom zip text field that validates against several country 
formats, i.e. US and Canada.  I have created specific country converters and 
validators that are utilized by this custom zip field.

In my test scenario, I have a valid US address displayed.  

I then change the country that has a AjaxFormComponentUpdatingBehavior which 
sends back the zip and state fields.  Note: zip field has a model reference of 
the country value which determines which validator/converter to use.

I change the zip to be a valid Canadian zip (A#A #A#) and submit the changes.

In my debug statements, I see the new value is parsed and validated with no 
error detected.

But what is interesting, the previous US zip value is also being validated 
which 
causes an unexpected.

Where did this zip value come from?  Did I forget to change/refresh a 
value/component?

Any help is much appreciated.

Thanks
- Doug