Re: [T5.2] Problem switching to VALIDATE from VALIDATE_FORM
On Fri, 15 Oct 2010 13:31:07 -0300, Blower, Andy wrote: From one of my developers: When using the VALIDATE event to validate form details, the validation method is called several times. @OnEvent(EventConstants.VALIDATE) void validateChooseFolderForm() { ... } You need to specify which component you want to listen the validate event, as most form field components also trigger them. Try @OnEvent(component = "yourFormTId", value = EventConstants.VALIDATE). -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.2] Problem switching to VALIDATE from VALIDATE_FORM
Components fire validate events as well as the form, so modify your @OnEvent to identify the form as the origin of the event. On Fri, Oct 15, 2010 at 9:31 AM, Blower, Andy wrote: > From one of my developers: > > When using the VALIDATE event to validate form details, the validation method > is called several times. > > Eg. > > �...@onevent(EventConstants.VALIDATE) > void validateChooseFolderForm() { > > ... > } > > Is called at least three times, executing different sections of the code each > time. Each time it is called, the test values show as null in Eclipse debug > mode, though I suspect it is being run once per field in the form. The third > time it is run, a NullPointerException is thrown by the "else if > (!isFolderNameUnique())" line. > > Workaround is to change to @OnEvent(EventConstants.VALIDATE_FORM). This only > calls the validate method once per submission. > > > This seems to have affected us in two places when deprecated events were > updated to the new version. Is this a known issue? > > Thanks, > > Andy > -- 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
[T5.2] Problem switching to VALIDATE from VALIDATE_FORM
>From one of my developers: When using the VALIDATE event to validate form details, the validation method is called several times. Eg. @OnEvent(EventConstants.VALIDATE) void validateChooseFolderForm() { ... } Is called at least three times, executing different sections of the code each time. Each time it is called, the test values show as null in Eclipse debug mode, though I suspect it is being run once per field in the form. The third time it is run, a NullPointerException is thrown by the "else if (!isFolderNameUnique())" line. Workaround is to change to @OnEvent(EventConstants.VALIDATE_FORM). This only calls the validate method once per submission. This seems to have affected us in two places when deprecated events were updated to the new version. Is this a known issue? Thanks, Andy