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