Now I'm all curious. After looking through FieldValidatorDefaultSource, FieldValidatorSource and the ValidationContstraintGenerator implementations, I'm not sure how a numeric field would automatically be validated as such. The Regexp validator is only reference in TapestryModule, which allows you to explicitly use it, but you're talking about something automatic.
I'm wondering what lead you to believe it would be automatically generated in the first place? Though Howard's suggestion that it isn't working right seems to imply that it should be doing that... On Thu, Mar 31, 2011 at 11:04 AM, Adam Zimowski <zimowsk...@gmail.com> wrote: > :) I don't think I'm in position to teach Tapestry to others, I'm > still learning myself.... But, using Eclipse I looked at class > hierarchy for: > > org.apache.tapestry5.AbstractValidator > > and see that Tapestry provides only the following out of the box: > > Email, Max, MaxLength, Min, MinLength, None, Regexp and Required > > So, just by guessing, I'd venture to say that Tapestry uses Regexp > validator to test if numeric field contains indeed a numeric value. > I'd also suspect that if there is a bug, it's probably in the regular > expression passed to Regexp validator on numeric field test, not the > validator itself. > > Again, I'm still learning myself, so somebody that actually knows for > sure would have to confirm, but that's be my guess. > > Adam > > On Thu, Mar 31, 2011 at 10:59 AM, Chris Norris > <thechrisproject.li...@gmail.com> wrote: >> Well perhaps you can teach me a few things. I'm trying to figure out >> by what mechanism tapestry would be validating this. We generally >> specify our custom NumericValidator on numeric fields. Is there some >> sort of automatic validation that can occur? I don't see much mention >> of it on this page: http://tapestry.apache.org/input-validation.html >> >> On Thu, Mar 31, 2011 at 10:54 AM, Adam Zimowski <zimowsk...@gmail.com> wrote: >>> No problem. Howard mentioned this may be a Tapestry bug. I'm in no >>> immediate rush as my project isn't going live until next year, so >>> hopefully by then it gets fixed. >>> >>> Adam >>> >>> On Thu, Mar 31, 2011 at 10:51 AM, Chris Norris >>> <thechrisproject.li...@gmail.com> wrote: >>>> Sorry, I was completely wrong. I was looking at a NumericValidator >>>> that we wrote, not a Tapestry one. >>>> >>>> On Thu, Mar 31, 2011 at 9:43 AM, Adam Zimowski <zimowsk...@gmail.com> >>>> wrote: >>>>> My client side validation is disabled. This happens on my shopping >>>>> cart page where I have multiple forms (inside a loop) with indexed >>>>> trackers ( Map<Integer, ValidationTracker>. You can find complete code >>>>> for the ShoppingCart page which exhibits this behavior in another >>>>> thread which I posted recently: >>>>> >>>>> "T5: form validation with pre-existing errors" >>>>> >>>>> The actual numeric field which exhibits this is defined in the template >>>>> as: >>>>> >>>>> <t:textfield t:id="quantity" t:context="index" >>>>> label="prop:quantityLabel" validate="required" size="2"/> >>>>> >>>>> >>>>> @Component(parameters = {"tracker=tracker"}) >>>>> private Form cartForm; >>>>> >>>>> @Persist(PersistenceConstants.FLASH) >>>>> private Map<Integer, ValidationTracker> indexedTrackers; >>>>> >>>>> public ValidationTracker getTracker() { >>>>> if(indexedTrackers == null) return new >>>>> ValidationTrackerImpl(); >>>>> return indexedTrackers.get(index); >>>>> } >>>>> >>>>> public void setTracker(ValidationTracker aTracker) { >>>>> >>>>> if(indexedTrackers == null) { >>>>> if(log.isTraceEnabled()) log.trace("crating >>>>> indexed trackers map"); >>>>> indexedTrackers = new HashMap<Integer, >>>>> ValidationTracker>(); >>>>> } >>>>> >>>>> if(log.isTraceEnabled()) { >>>>> log.trace("setting tracker for index: " + index); >>>>> } >>>>> >>>>> indexedTrackers.put(index, aTracker); >>>>> } >>>>> >>>>> In addition, this field carries a mixin: >>>>> >>>>> @Component(id=ID_QUANTITY_FIELD, parameters >>>>> ={"AttachError.message=fieldError"}) >>>>> @MixinClasses(value=AttachError.class) >>>>> private TextField quantityField; >>>>> >>>>> @MixinAfter >>>>> public class AttachError { >>>>> >>>>> @Parameter(required = true, allowNull = true) >>>>> private String message; >>>>> >>>>> @Environmental >>>>> private ValidationTracker tracker; >>>>> >>>>> @InjectContainer >>>>> private Field field; >>>>> >>>>> >>>>> void setupRender() { >>>>> if (message != null) { >>>>> tracker.recordError(field, message); >>>>> } >>>>> } >>>>> } >>>>> >>>>> public String getFieldError() { >>>>> String error = null; >>>>> ValidationTracker tracker = getTracker(); >>>>> if(tracker != null && tracker.getError(quantityField) != >>>>> null) { >>>>> return null; >>>>> } >>>>> CartItemBean cib = >>>>> findCartItem(cartDisplayItem.getLineNumber()); >>>>> >>>>> // look up error in CartItemBean and if found return it, or return >>>>> null; >>>>> >>>>> return error; >>>>> } >>>>> >>>>> Let me know, perhaps I am doing something wrong.. >>>>> >>>>> Adam >>>>> >>>>> On Thu, Mar 31, 2011 at 9:03 AM, Chris Norris >>>>> <thechrisproject.li...@gmail.com> wrote: >>>>>> The Tapestry NumericValidator seems to rely on whether >>>>>> Double.valueOf(String) will throw an exception, which it does for >>>>>> '1k'. >>>>>> >>>>>> How are you configuring and using your validator? >>>>>> >>>>>> On Tue, Mar 29, 2011 at 5:19 PM, Adam Zimowski <zimowsk...@gmail.com> >>>>>> wrote: >>>>>>> It is server side. Looks like if input starts with a digit, Tapestry is >>>>>>> happy :) >>>>>>> >>>>>>> Adam >>>>>>> >>>>>>> On Tue, Mar 29, 2011 at 5:05 PM, Howard Lewis Ship <hls...@gmail.com> >>>>>>> wrote: >>>>>>>> Seems like a bug to me! Surprising, though. Is this server-side or >>>>>>>> client-side validation? >>>>>>>> >>>>>>>> On Tue, Mar 29, 2011 at 2:49 PM, Adam Zimowski <zimowsk...@gmail.com> >>>>>>>> wrote: >>>>>>>>> For numeric fields, Tapestry validates correctly non-numeric input. >>>>>>>>> However, input such as: >>>>>>>>> >>>>>>>>> 1k >>>>>>>>> 1\ >>>>>>>>> etc.. >>>>>>>>> >>>>>>>>> passes the validation. >>>>>>>>> >>>>>>>>> Am I missing something? >>>>>>>>> >>>>>>>>> Adam >>>>>>>>> >>>>>>>>> --------------------------------------------------------------------- >>>>>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>>>>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> Howard M. Lewis Ship >>>>>>>> >>>>>>>> Creator of Apache Tapestry >>>>>>>> >>>>>>>> The source for Tapestry training, mentoring and support. Contact me to >>>>>>>> learn how I can get you up and productive in Tapestry fast! >>>>>>>> >>>>>>>> (971) 678-5210 >>>>>>>> http://howardlewisship.com >>>>>>>> >>>>>>>> --------------------------------------------------------------------- >>>>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>>>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> --------------------------------------------------------------------- >>>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>>>>> >>>>>>> >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>>>> >>>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>>> >>>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>>> For additional commands, e-mail: users-h...@tapestry.apache.org >>>> >>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org