Re: Redirect onActivate - how to handle ActionLink requests?
This is exactly what I was looking for! Thank you. Although I still notice a strange issue. In all cases except one the following works: componentEventLinkEncoder.decodePageRenderRequest(request) != null Except on the request made by the autocomplete mixin (http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/mixins/Autocomplete.html) that I am using. The path for the autocomplete request is: /editcube.card:autocomplete but componentEventLinkEncoder.decodePageRenderRequest(request) returns PageRenderRequestParameters[CubeBlog]. CubeBlog is the name of my START_PAGE_NAME as defined in AppModule. As a result I've been using componentEventLinkEncoder.decodeComponentEventRequest(request) == null This works fine for everything, but I am curious if anyone could explain why decodePageRenderRequest doesn't seem to behave as expected for the autocomplete mixin request? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Redirect-onActivate-how-to-handle-ActionLink-requests-tp5718883p5718916.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Redirect onActivate - how to handle ActionLink requests?
So I have a page 'ViewCube'. This page can be accessed by anyone and does not allow any editing rights. I then have a page 'EditCube' which extends ViewCube and uses some extension points to allow the user with editing rights to modify the cube (please don't worry about what a Cube is!) I want to make sure that unauthorised users cannot access the EditCube page, so I have the following redirect onActivate: @OnEvent(EventConstants.ACTIVATE) public Object checkUser() throws IOException { if(isPageRequest()) { if(!userService.isLoggedIn() || !userService.getActiveUser().getId().equals(getCube().getUserId())) { return linkSource.createPageRenderLinkWithContext(ViewCube, getCube().getId()); } } return null; } I don't want to bother doing this checking if the request is XHR or a POST, so I have this check: protected boolean isPageRequest() { return !request.isXHR() request.getMethod()==GET; } Problem is, when I have a normal actionLink component: t:actionLink t:id=AddCard id=AddCardJust Add/t:actionLink Inside a component called 'CardLightBox' in EditCube. When this makes the following request: /editcube.cardlightbox.addcard The onActivate method kicks in, returning null and my request is not fulfilled by the event handler in the page class. So - am I doing the redirect in the right way? Is this inheritance sensible? I tried using response.sendRedirect so that I don't need a return value but this fails with the following: java.lang.NullPointerException org.apache.tapestry5.internal.services.assets.CompressionAnalyzerImpl.isCompressable(CompressionAnalyzerImpl.java:34) $CompressionAnalyzer_13f1db2b6d3d1a.isCompressable(Unknown Source) Any help much appreciated. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Redirect-onActivate-how-to-handle-ActionLink-requests-tp5718883.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Redirect onActivate - how to handle ActionLink requests?
Hi Thiago, Ok but I don't believe that my problem is directly related to inheritance, but point taken on the style preference. Even if I have two separate pages with components I will still need the check in the edit page with the redirect to the view page. In this case, how do I handle actionLink requests hitting the onActivate() and getting null returned without hitting the handler? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Redirect-onActivate-how-to-handle-ActionLink-requests-tp5718883p5718893.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Redirect onActivate - how to handle ActionLink requests?
I actually got the problem wrong, it's not the fact that the null return prevented the handler from firing, but rather my condition to determine if it was a page request rather than a component request was insufficient: protected boolean isPageRequest() { return !request.isXHR() request.getMethod()==GET; } And it was ending up redirecting. What is the preferred way to check in an onActivate method whether the originating request is a page request or simply a component like an actionLink making a request? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Redirect-onActivate-how-to-handle-ActionLink-requests-tp5718883p5718894.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Updating a Zone with just form fields (not the form itself)
I'll start by giving this problem a bit of background. I've been charged with adding 'Postcode Lookup' functionality to the registration form on our site. When a user enters a postcode, it calls off to a third party service, and we provide a set of possible addresses in a drop down box. The user selects one, and we use this selection to populate a bunch of form fields. There are three clear states here a) Initial State (Postcode Field) b) Select Address State (Select box) c) Display selected address state (a bunch of text fields) I felt that Tapestry Zones in conjunction with action links (using Inge's ZoneUpdater mixin to get the form values into the page class) should be suitable for this problem. Of course our registration form has a whole bunch of fields besides address fields, and we want to encapsulate the postcode lookup logic into a component. So, on to the problem. Here is a cutdown version of my template: t:form t:id=registerForm ... other fields here ... t:addressLookup/ t:submit/ /t:form Address Lookup Template: t:zone t:id=addressZone id=addressZone t:update=show t:delegate to=addressStatus / /t:zone t:block t:id=findAddressBlock t:label for=findHouseNumber / t:textfield t:id=findHouseNumber t:value=houseNumber/ t:label for=postCode / t:textfield t:id=findPostCode t:value=postCode/ t:actionlink t:id=findAddressLink zone=addressZoneFind Address/t:actionlink /t:block t:block t:id=selectAddressBlock t:select t:id=selectAddress t:value=selectedAddressIndex t:model=addressModel blankOption=never t:mixins=zoneUpdater zone=addressZone t:event=selectChange t:clientEvent=change/ t:actionlink t:id=selectAddressLinkSelect Address/t:actionlink /t:block t:block t:id=displayAddressBlock some form fields here ... /t:block The actionlinks and basic zone functionality is working fine, but when my addressStatus delegate returns (for example) the selectAddressBlock as part of a zone update, I get the following error: org.apache.tapestry5.ioc.internal.util.TapestryException: The Select Address component must be enclosed by a Form component Whats happening here is that Tapestry is unable to attach the new form fields to their containing form. I've had a read around and the only solution seems to be to put the whole form inside the zone. This isn't really viable in this case, because our register form is quite large and it breaks the nice componentisation that Tapestry is giving us. Thought I'd throw it out there to the ever helpful Tapestry mailing list and see if you can provide any nuggets of advice or perhaps suggestions for an alternative to using Zones. -- View this message in context: http://old.nabble.com/Updating-a-Zone-with-just-form-fields-%28not-the-form-itself%29-tp28679165p28679165.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Updating a Zone with just form fields (not the form itself)
Thanks Christophe, I wasn't aware of this component. A quick google around hasn't yielded very much, are you able to point me in the direction of a solid example, or maybe provide some sample code here? Christophe Cordenier wrote: Hi I think FormInjector will better suits to your needs. Regards, Christophe Cordenier. 2010/5/26 lebenski be...@gamesys.co.uk I'll start by giving this problem a bit of background. I've been charged with adding 'Postcode Lookup' functionality to the registration form on our site. When a user enters a postcode, it calls off to a third party service, and we provide a set of possible addresses in a drop down box. The user selects one, and we use this selection to populate a bunch of form fields. There are three clear states here a) Initial State (Postcode Field) b) Select Address State (Select box) c) Display selected address state (a bunch of text fields) I felt that Tapestry Zones in conjunction with action links (using Inge's ZoneUpdater mixin to get the form values into the page class) should be suitable for this problem. Of course our registration form has a whole bunch of fields besides address fields, and we want to encapsulate the postcode lookup logic into a component. So, on to the problem. Here is a cutdown version of my template: t:form t:id=registerForm ... other fields here ... t:addressLookup/ t:submit/ /t:form Address Lookup Template: t:zone t:id=addressZone id=addressZone t:update=show t:delegate to=addressStatus / /t:zone t:block t:id=findAddressBlock t:label for=findHouseNumber / t:textfield t:id=findHouseNumber t:value=houseNumber/ t:label for=postCode / t:textfield t:id=findPostCode t:value=postCode/ t:actionlink t:id=findAddressLink zone=addressZoneFind Address/t:actionlink /t:block t:block t:id=selectAddressBlock t:select t:id=selectAddress t:value=selectedAddressIndex t:model=addressModel blankOption=never t:mixins=zoneUpdater zone=addressZone t:event=selectChange t:clientEvent=change/ t:actionlink t:id=selectAddressLinkSelect Address/t:actionlink /t:block t:block t:id=displayAddressBlock some form fields here ... /t:block The actionlinks and basic zone functionality is working fine, but when my addressStatus delegate returns (for example) the selectAddressBlock as part of a zone update, I get the following error: org.apache.tapestry5.ioc.internal.util.TapestryException: The Select Address component must be enclosed by a Form component Whats happening here is that Tapestry is unable to attach the new form fields to their containing form. I've had a read around and the only solution seems to be to put the whole form inside the zone. This isn't really viable in this case, because our register form is quite large and it breaks the nice componentisation that Tapestry is giving us. Thought I'd throw it out there to the ever helpful Tapestry mailing list and see if you can provide any nuggets of advice or perhaps suggestions for an alternative to using Zones. -- View this message in context: http://old.nabble.com/Updating-a-Zone-with-just-form-fields-%28not-the-form-itself%29-tp28679165p28679165.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Developer of wooki @wookicentral.com -- View this message in context: http://old.nabble.com/Updating-a-Zone-with-just-form-fields-%28not-the-form-itself%29-tp28679165p28679299.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
[T5.1.0.5] Ajax submission Event.stop is not a function
I have bound the zone parameter to my form: t:form t:id=pickCommentForm context=[packCard,draftPick,draftId] zone=prop:zoneId /t:form And the zone itself: t:zone t:id=otherCommentsZone id=prop:zoneId t:update=show /t:zone This has been working fine until recently. I was forced to upgrade to prototype 1.6.1 using tapx-prototype and ever since I'm observing that my forms that were previously submitting as XHR requests are now submitting as plain old form submits (without the x-requested-with header). The section of tapestry js that is failing: // This flag can be set to prevent the form from submitting normally. 1172 // This is used for some Ajax cases where the form submission must 1173 // run via Ajax.Request. 1174 1175 if (this.preventSubmission) 1176 { 1177 // Prevent the normal submission. 1178 1179 Event.stop(domevent); 1180 1181 // Instead ... 1182 1183 this.form.fire(Tapestry.FORM_PROCESS_SUBMIT_EVENT); 1184 1185 return false; 1186 } 1187 With the error Event.stop is not a function. A google around hasn't thrown up anything. Any ideas? -- View this message in context: http://old.nabble.com/-T5.1.0.5--Ajax-submission-%22Event.stop-is-not-a-function%22-tp27804989p27804989.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] Form and Zone inside a loop
Well I eventually got to the root of this. The problem was being caused because the IDs I'd given to my zones started witha number! Changing them from 1_1Zone to Zone1_1 fixed the issue. Also got this working with MultiZoneUpdate now, I love this component. Great job by the Tapestry devs. -- View this message in context: http://old.nabble.com/-T5--Form-and-Zone-inside-a-loop-tp27400993p27417440.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 - Forms created inside a loop don't fire onSuccess methods
Thanks - got this working! Thiago H. de Paula Figueiredo wrote: On Sun, 31 Jan 2010 16:09:11 -0200, lebenski be...@gamesys.co.uk wrote: Hi, Hi! This is my code: t:loop source=draft.draftPicks value=draftPick volatile=true t:form t:id=pickCommentForm ... t:submit value=message:submit-label / /t:form /t:loop I'm obsering that submitting this form does not fire onSuccessFromPickCommentForm or even just onSuccess, onValidateForm etc. Is this because i've created multiple forms with the same id? If so, is there a way to support form creation inside a loop like this? Each Form component has a different id. Just use onSuccess() and use draftPick as the context to your form. Something like this: t:loop source=draft.draftPicks value=draftPick volatile=true t:form t:id=pickCommentForm t:context=draftPick.id ... t:submit value=message:submit-label / /t:form /t:loop Object onSuccess(Integer id) { DraftPick draftPick = load(id); createPickComment(draftPick, getNewComment()); } By the way, you don't need to use the Submit component unless you have more than one submit button in the same form. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, 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 -- View this message in context: http://old.nabble.com/T5---Forms-created-inside-a-loop-don%27t-fire-onSuccess-methods-tp27395072p27400845.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
[T5] Form and Zone inside a loop
I have a loop that contains a form and a zone. In each iteration of the loop, submission of that form should update it's relevant zone: t:loop source=draft.draftPicks value=draftPick volatile=true t:form t:id=pickCommentForm context=draftPick t:zone=${zoneId} ... t:submit/ /t:form t:zone t:id=otherCommentsZone id=${zoneId} div class=otherCommentsBody ... /div /t:zone /t:loop Object onSuccessFromPickCommentForm(DraftPick draftPick) { createPickComment(draft.get(draftPick.getPackNumber(), draftPick.getPickNumber())); loadDraft(); return otherCommentsZone; } So i'm binding the zone parameter of the form to the generated client id (not the component id) as suggested in the documentation here: http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Zone.html After I submit the form the page refreshes rather that updating the zone. The loop runs 45 times so I end up with 45 micro forms and 45 zones on my page. Can anyone see what I'm doing wrong here? -- View this message in context: http://old.nabble.com/-T5--Form-and-Zone-inside-a-loop-tp27400993p27400993.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] Form and Zone inside a loop
Ah! this seems to have got to the root of the problem. Request.isXHR() is returning false. I understand that this method is looking for the presence of an Http Header called X-Requested-With with the value XMLHttpRequest. Snooping the request I notice that this has not been set. How does this header get set, and what in my example could cause this not to be getting set? Ulrich Stärk wrote: You should @InjectComponent private Zone otherCommentsZone and return otherCommentsZone.getBody() from your onSuccess handler method after checking whether this is a XHR request (@Inject Request and do request.isXHR()). Uli On 01.02.2010 09:29 schrieb lebenski: I have a loop that contains a form and a zone. In each iteration of the loop, submission of that form should update it's relevant zone: t:loop source=draft.draftPicks value=draftPick volatile=true t:form t:id=pickCommentForm context=draftPick t:zone=${zoneId} ... t:submit/ /t:form t:zone t:id=otherCommentsZone id=${zoneId} div class=otherCommentsBody ... /div /t:zone /t:loop Object onSuccessFromPickCommentForm(DraftPick draftPick) { createPickComment(draft.get(draftPick.getPackNumber(), draftPick.getPickNumber())); loadDraft(); return otherCommentsZone; } So i'm binding the zone parameter of the form to the generated client id (not the component id) as suggested in the documentation here: http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Zone.html After I submit the form the page refreshes rather that updating the zone. The loop runs 45 times so I end up with 45 micro forms and 45 zones on my page. Can anyone see what I'm doing wrong here? - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- View this message in context: http://old.nabble.com/-T5--Form-and-Zone-inside-a-loop-tp27400993p27402655.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] Form and Zone inside a loop
Yes, this is what I have: t:form t:id=pickCommentForm context=draftPick t:zone=prop:zoneId t:zone t:id=otherCommentsZone id=prop:zoneId public String getZoneId() { return draftPick.getPackNumber() + _ + draftPick.getPickNumber() + Zone; } Giving all of my zones id's like this 1_7Zone I've also tried removing the t: prefix from the zone parameter, this seems to make no difference. Ulrich Stärk wrote: Normally that happens when zone and form aren't set up correctly on the client side, e.g. due to inconsistent IDs. Did you try as Christophe suggested? Replace t:zone=${zoneId} with t:zone=prop:zoneId (same for the id parameter of zone). Does that help? Uli On 01.02.2010 12:15 schrieb lebenski: Ah! this seems to have got to the root of the problem. Request.isXHR() is returning false. I understand that this method is looking for the presence of an Http Header called X-Requested-With with the value XMLHttpRequest. Snooping the request I notice that this has not been set. How does this header get set, and what in my example could cause this not to be getting set? Ulrich Stärk wrote: You should @InjectComponent private Zone otherCommentsZone and return otherCommentsZone.getBody() from your onSuccess handler method after checking whether this is a XHR request (@Inject Request and do request.isXHR()). Uli On 01.02.2010 09:29 schrieb lebenski: I have a loop that contains a form and a zone. In each iteration of the loop, submission of that form should update it's relevant zone: t:loop source=draft.draftPicks value=draftPick volatile=true t:form t:id=pickCommentForm context=draftPick t:zone=${zoneId} ... t:submit/ /t:form t:zone t:id=otherCommentsZone id=${zoneId} div class=otherCommentsBody ... /div /t:zone /t:loop Object onSuccessFromPickCommentForm(DraftPick draftPick) { createPickComment(draft.get(draftPick.getPackNumber(), draftPick.getPickNumber())); loadDraft(); return otherCommentsZone; } So i'm binding the zone parameter of the form to the generated client id (not the component id) as suggested in the documentation here: http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Zone.html After I submit the form the page refreshes rather that updating the zone. The loop runs 45 times so I end up with 45 micro forms and 45 zones on my page. Can anyone see what I'm doing wrong here? - 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 -- View this message in context: http://old.nabble.com/-T5--Form-and-Zone-inside-a-loop-tp27400993p27403412.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5 - Forms created inside a loop don't fire onSuccess methods
Hi, This is my code: t:loop source=draft.draftPicks value=draftPick volatile=true t:form t:id=pickCommentForm ... t:submit value=message:submit-label / /t:form /t:loop This results in multiple forms getting rendered on my page; pickCommentForm, pickCommentForm_0, pickCommentForm_1 etc. I'm obsering that submitting this form does not fire onSuccessFromPickCommentForm or even just onSuccess, onValidateForm etc. Is this because i've created multiple forms with the same id? If so, is there a way to support form creation inside a loop like this? Object onSuccessFromPickCommentForm() { createPickComment(draftPick, getNewComment()); } -- View this message in context: http://old.nabble.com/T5---Forms-created-inside-a-loop-don%27t-fire-onSuccess-methods-tp27395072p27395072.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.0.18] @InjectedPage does not have access to it's own layout
Hi, Sorry I've been away for a few days hence the lack of reply. Inge, I tried to explain my problem carefully and precisely as Igor indicated that he didn't understand it. Of course my problem doesn't make sense, if it made sense I could solve it and it wouldn't be a problem! Feel free to hit me with some obvious questions... I have tried all sorts of event handlers including onSuccess in the layout and inside the confirmation component, it simply never gets called whatever I choose. My original reason for posting was to see if there was a recognised issue/limitation in this area (injecting pages) that I was not aware of. Judging by the reactions i've had there is not. I still have no solution but when I find out what my problem was i'll make sure to check back. Cheers, Ben. Inge Solvoll-2 wrote: I don't know. What I DO know is this: Trying hard to explain why your problem doesn't make sense is not a very good way of solving it. I do that very often, and I'm always corrected by someone who asks the obvious questions ;) The best way is to binary search your way through this, by modifying your code step by step in order to find out when the event handler will actually be called on the page where the problem is. Then you can step back and you will most likely find that your problem was a rather trivial one. To the other guys: Is there a way in an event handler like onSuccess to find out which component triggered the event? On Tue, Jan 5, 2010 at 11:38 AM, lebenski be...@gamesys.co.uk wrote: Ok I think I'm missing something because I don't understand why this would happen. If I have two pages: Page1.tml t:layout Page 1 Goes Here /t:layout Page2.tml t:layout Page 2 Goes Here /t:layout And a layout... Layout.tml (simplified) html body t:form t:id=hello ...form content /t:form /body /html Layout.java ... void onSuccessFromHelloForm() { System.out.println(Hello called); } Page 1 is accessed using a normal pagelink: t:pagelink page=Page1Page1/pagelink But Page 2 is returned from a method call on some other page and injected using InjectPage: SomeOtherPage.java @InjectPage private Page2 page2; Object doSomething() { //something happens return page2; } How come the onSuccessFromHelloForm() is called when I submit the hello form contained in the layout on page1, but not when I submit the hello form contained in the layout on page 2? Why has the origin changed in this case? Inge Solvoll-2 wrote: I only suggested it for testing to see if it gets called. If it gets called, it means that the origin changed, and your FromXXX must be changed. On Tue, Jan 5, 2010 at 11:23 AM, lebenski be...@gamesys.co.uk wrote: This isn't the form I'm having trouble with. The Submit a Question form works fine. The form that is not working is the LoginForm in the layout. Using onSuccessFromLoginForm works in all other pages except the confirmation page. Are you suggesting that I should change the method in my layout class to onSuccess? this won't work as this method will get called for all forms on the site (as it resides in the layout). Inge Solvoll-2 wrote: I think what Howard said was that your FromQuestionForm part won't work, since the origin changes when the event bubbles up. Change the name to onSuccess and see if gets called then. On Tue, Jan 5, 2010 at 10:47 AM, lebenski be...@gamesys.co.uk wrote: Hi Igor, I thought i'd spelled out this issue fairly clearly, but here goes again. All of my pages use a layout along these lines: http://tapestry.apache.org/tapestry5/guide/layout.html Inside this component I have a login form. This login form works on all pages, except for a specific page called 'Confirmation'. I use this page slightly differently to the others by injecting it using @InjectPage, setting a couple of properties on it, and then returning it: @InjectPage private Confirmation confirmation; Object onSuccessFromQuestionForm() { //processing confirmation.setType(ConfirmationType.SUCCESS); confirmation.setMessage(Messages.get(question-submit)); return confirmation; } For some reason, the login form does not work on the Confirmation page, the onSuccessFromLoginForm method that resides within my layout is simply never called. My hunch is that this issue is something to do with a nuance of the @InjectPage annotation that causes the page to behave differently, but I'm really not sure. I hope this is clearer. Igor Drobiazko wrote: Your explanation is unclear. This way you never get an answer. Please be more precise and post more of your code. On Mon, Jan 4, 2010 at 11:07 AM, lebenski be...@gamesys.co.uk wrote: I have a layout component that contains a login
Re: [T5.0.18] @InjectedPage does not have access to it's own layout
Thanks for your reply Howard. Are you suggesting that I need to add this onSuccess method to my confirmation page as well as keeping it in the layout? Howard Lewis Ship wrote: When an event bubbles up, the origin of the event changes. Initially, the success event occurs from the form inside the layout component. If the event is not handled there, it becomes a success event *from the layout component* (at the page). -- 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 -- View this message in context: http://old.nabble.com/-T5.0.18--%40InjectedPage-does-not-have-access-to-it%27s-own-layout-tp27010913p27025001.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.0.18] @InjectedPage does not have access to it's own layout
Hi Igor, I thought i'd spelled out this issue fairly clearly, but here goes again. All of my pages use a layout along these lines: http://tapestry.apache.org/tapestry5/guide/layout.html Inside this component I have a login form. This login form works on all pages, except for a specific page called 'Confirmation'. I use this page slightly differently to the others by injecting it using @InjectPage, setting a couple of properties on it, and then returning it: @InjectPage private Confirmation confirmation; Object onSuccessFromQuestionForm() { //processing confirmation.setType(ConfirmationType.SUCCESS); confirmation.setMessage(Messages.get(question-submit)); return confirmation; } For some reason, the login form does not work on the Confirmation page, the onSuccessFromLoginForm method that resides within my layout is simply never called. My hunch is that this issue is something to do with a nuance of the @InjectPage annotation that causes the page to behave differently, but I'm really not sure. I hope this is clearer. Igor Drobiazko wrote: Your explanation is unclear. This way you never get an answer. Please be more precise and post more of your code. On Mon, Jan 4, 2010 at 11:07 AM, lebenski be...@gamesys.co.uk wrote: I have a layout component that contains a login form: t:form t:id=loginForm t:textfield t:id=loginUsernameField t:value=memberName height=30/ t:passwordfield t:id=loginPasswordField t:value=password / t:submit id=loginSubmit value=message:login/ /t:form Page Class: Object onSuccessFromLoginForm() { try{ loggedInMember = loginManager.logUserIn(new Login(memberName, password)); } catch(LoginException e) { //Login Error Processing } return Index.class; } I also have a generic confirmation page which I use for page flows where I need to present some message to the user. For example Thanks for submitting a question SubmitQuestion.java @InjectPage private Confirmation confirmation; Object onSuccessFromQuestionForm() { //processing confirmation.setType(ConfirmationType.SUCCESS); confirmation.setMessage(Messages.get(question-submit)); return confirmation; } The confirmation template itself is inside the layout: t:layout xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd; ${type}br/ ${message} /t:layout However, for some reason I don't seem to have access to the layout from this confirmation page. If I try to use the login form, the Index page is loaded but the user is not logged in. In fact as far as I can see (through debugging), the onSuccessFromLoginForm() method in the Layout is never called. I'm at a bit of a loss as to why this is happening, as this is working on all other pages in my application. Is there some specific nuance of using @InjectPage that could be causing this issue? -- View this message in context: http://old.nabble.com/-T5.0.18--%40InjectedPage-does-not-have-access-to-it%27s-own-layout-tp27010913p27010913.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Best regards, Igor Drobiazko http://tapestry5.de/blog -- View this message in context: http://old.nabble.com/-T5.0.18--%40InjectedPage-does-not-have-access-to-it%27s-own-layout-tp27010913p27025941.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.0.18] @InjectedPage does not have access to it's own layout
This isn't the form I'm having trouble with. The Submit a Question form works fine. The form that is not working is the LoginForm in the layout. Using onSuccessFromLoginForm works in all other pages except the confirmation page. Are you suggesting that I should change the method in my layout class to onSuccess? this won't work as this method will get called for all forms on the site (as it resides in the layout). Inge Solvoll-2 wrote: I think what Howard said was that your FromQuestionForm part won't work, since the origin changes when the event bubbles up. Change the name to onSuccess and see if gets called then. On Tue, Jan 5, 2010 at 10:47 AM, lebenski be...@gamesys.co.uk wrote: Hi Igor, I thought i'd spelled out this issue fairly clearly, but here goes again. All of my pages use a layout along these lines: http://tapestry.apache.org/tapestry5/guide/layout.html Inside this component I have a login form. This login form works on all pages, except for a specific page called 'Confirmation'. I use this page slightly differently to the others by injecting it using @InjectPage, setting a couple of properties on it, and then returning it: @InjectPage private Confirmation confirmation; Object onSuccessFromQuestionForm() { //processing confirmation.setType(ConfirmationType.SUCCESS); confirmation.setMessage(Messages.get(question-submit)); return confirmation; } For some reason, the login form does not work on the Confirmation page, the onSuccessFromLoginForm method that resides within my layout is simply never called. My hunch is that this issue is something to do with a nuance of the @InjectPage annotation that causes the page to behave differently, but I'm really not sure. I hope this is clearer. Igor Drobiazko wrote: Your explanation is unclear. This way you never get an answer. Please be more precise and post more of your code. On Mon, Jan 4, 2010 at 11:07 AM, lebenski be...@gamesys.co.uk wrote: I have a layout component that contains a login form: t:form t:id=loginForm t:textfield t:id=loginUsernameField t:value=memberName height=30/ t:passwordfield t:id=loginPasswordField t:value=password / t:submit id=loginSubmit value=message:login/ /t:form Page Class: Object onSuccessFromLoginForm() { try{ loggedInMember = loginManager.logUserIn(new Login(memberName, password)); } catch(LoginException e) { //Login Error Processing } return Index.class; } I also have a generic confirmation page which I use for page flows where I need to present some message to the user. For example Thanks for submitting a question SubmitQuestion.java @InjectPage private Confirmation confirmation; Object onSuccessFromQuestionForm() { //processing confirmation.setType(ConfirmationType.SUCCESS); confirmation.setMessage(Messages.get(question-submit)); return confirmation; } The confirmation template itself is inside the layout: t:layout xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd ${type}br/ ${message} /t:layout However, for some reason I don't seem to have access to the layout from this confirmation page. If I try to use the login form, the Index page is loaded but the user is not logged in. In fact as far as I can see (through debugging), the onSuccessFromLoginForm() method in the Layout is never called. I'm at a bit of a loss as to why this is happening, as this is working on all other pages in my application. Is there some specific nuance of using @InjectPage that could be causing this issue? -- View this message in context: http://old.nabble.com/-T5.0.18--%40InjectedPage-does-not-have-access-to-it%27s-own-layout-tp27010913p27010913.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Best regards, Igor Drobiazko http://tapestry5.de/blog -- View this message in context: http://old.nabble.com/-T5.0.18--%40InjectedPage-does-not-have-access-to-it%27s-own-layout-tp27010913p27025941.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- View this message in context: http://old.nabble.com/-T5.0.18--%40InjectedPage-does-not-have-access-to-it%27s-own-layout-tp27010913p27026345.html Sent from the Tapestry - User mailing list archive at Nabble.com
Re: [T5.0.18] @InjectedPage does not have access to it's own layout
Ok I think I'm missing something because I don't understand why this would happen. If I have two pages: Page1.tml t:layout Page 1 Goes Here /t:layout Page2.tml t:layout Page 2 Goes Here /t:layout And a layout... Layout.tml (simplified) html body t:form t:id=hello ...form content /t:form /body /html Layout.java ... void onSuccessFromHelloForm() { System.out.println(Hello called); } Page 1 is accessed using a normal pagelink: t:pagelink page=Page1Page1/pagelink But Page 2 is returned from a method call on some other page and injected using InjectPage: SomeOtherPage.java @InjectPage private Page2 page2; Object doSomething() { //something happens return page2; } How come the onSuccessFromHelloForm() is called when I submit the hello form contained in the layout on page1, but not when I submit the hello form contained in the layout on page 2? Why has the origin changed in this case? Inge Solvoll-2 wrote: I only suggested it for testing to see if it gets called. If it gets called, it means that the origin changed, and your FromXXX must be changed. On Tue, Jan 5, 2010 at 11:23 AM, lebenski be...@gamesys.co.uk wrote: This isn't the form I'm having trouble with. The Submit a Question form works fine. The form that is not working is the LoginForm in the layout. Using onSuccessFromLoginForm works in all other pages except the confirmation page. Are you suggesting that I should change the method in my layout class to onSuccess? this won't work as this method will get called for all forms on the site (as it resides in the layout). Inge Solvoll-2 wrote: I think what Howard said was that your FromQuestionForm part won't work, since the origin changes when the event bubbles up. Change the name to onSuccess and see if gets called then. On Tue, Jan 5, 2010 at 10:47 AM, lebenski be...@gamesys.co.uk wrote: Hi Igor, I thought i'd spelled out this issue fairly clearly, but here goes again. All of my pages use a layout along these lines: http://tapestry.apache.org/tapestry5/guide/layout.html Inside this component I have a login form. This login form works on all pages, except for a specific page called 'Confirmation'. I use this page slightly differently to the others by injecting it using @InjectPage, setting a couple of properties on it, and then returning it: @InjectPage private Confirmation confirmation; Object onSuccessFromQuestionForm() { //processing confirmation.setType(ConfirmationType.SUCCESS); confirmation.setMessage(Messages.get(question-submit)); return confirmation; } For some reason, the login form does not work on the Confirmation page, the onSuccessFromLoginForm method that resides within my layout is simply never called. My hunch is that this issue is something to do with a nuance of the @InjectPage annotation that causes the page to behave differently, but I'm really not sure. I hope this is clearer. Igor Drobiazko wrote: Your explanation is unclear. This way you never get an answer. Please be more precise and post more of your code. On Mon, Jan 4, 2010 at 11:07 AM, lebenski be...@gamesys.co.uk wrote: I have a layout component that contains a login form: t:form t:id=loginForm t:textfield t:id=loginUsernameField t:value=memberName height=30/ t:passwordfield t:id=loginPasswordField t:value=password / t:submit id=loginSubmit value=message:login/ /t:form Page Class: Object onSuccessFromLoginForm() { try{ loggedInMember = loginManager.logUserIn(new Login(memberName, password)); } catch(LoginException e) { //Login Error Processing } return Index.class; } I also have a generic confirmation page which I use for page flows where I need to present some message to the user. For example Thanks for submitting a question SubmitQuestion.java @InjectPage private Confirmation confirmation; Object onSuccessFromQuestionForm() { //processing confirmation.setType(ConfirmationType.SUCCESS); confirmation.setMessage(Messages.get(question-submit)); return confirmation; } The confirmation template itself is inside the layout: t:layout xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd ${type}br/ ${message} /t:layout However, for some reason I don't seem to have access to the layout from this confirmation page. If I try to use the login form, the Index page is loaded but the user is not logged in. In fact as far as I can see (through debugging), the onSuccessFromLoginForm() method in the Layout is never called. I'm at a bit of a loss as to why this is happening, as this is working on all other pages in my application
[T5.0.18] @InjectedPage does not have access to it's own layout
I have a layout component that contains a login form: t:form t:id=loginForm t:textfield t:id=loginUsernameField t:value=memberName height=30/ t:passwordfield t:id=loginPasswordField t:value=password / t:submit id=loginSubmit value=message:login/ /t:form Page Class: Object onSuccessFromLoginForm() { try{ loggedInMember = loginManager.logUserIn(new Login(memberName, password)); } catch(LoginException e) { //Login Error Processing } return Index.class; } I also have a generic confirmation page which I use for page flows where I need to present some message to the user. For example Thanks for submitting a question SubmitQuestion.java @InjectPage private Confirmation confirmation; Object onSuccessFromQuestionForm() { //processing confirmation.setType(ConfirmationType.SUCCESS); confirmation.setMessage(Messages.get(question-submit)); return confirmation; } The confirmation template itself is inside the layout: t:layout xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd; ${type}br/ ${message} /t:layout However, for some reason I don't seem to have access to the layout from this confirmation page. If I try to use the login form, the Index page is loaded but the user is not logged in. In fact as far as I can see (through debugging), the onSuccessFromLoginForm() method in the Layout is never called. I'm at a bit of a loss as to why this is happening, as this is working on all other pages in my application. Is there some specific nuance of using @InjectPage that could be causing this issue? -- View this message in context: http://old.nabble.com/-T5.0.18--%40InjectedPage-does-not-have-access-to-it%27s-own-layout-tp27010913p27010913.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Spring Security with T5RESTful Services
Think you might've put this in the wrong place Jim! I assume you mean't to start a new thread? jc1001 wrote: Has anyone got Spring Security annotations (@Secured(ROLE_XYZ) etc.) working with the restful web services implementation http://code.google.com/p/t5-restful-webservices - I'd rather not alter the source if someone already has a workaround (ordering filters?) would love to hear from you - thanks. Regards, Jim. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- View this message in context: http://old.nabble.com/-T5.0.18--%40InjectedPage-does-not-have-access-to-it%27s-own-layout-tp27010913p27011077.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Javascript at the bottom of page
Hi This has been an issue for a while now - we're using prototype etc. to manipulate elements in some of our pages but can't access it due to it being loaded at the end of the page. I have read on these forums before that javascript should be loaded at the end of the page to increase load speeds, however this should only be done when javascript isn't used for changing the layout of the page - could tapestry please change this behaviour as it's creating a major headache for us (and I'm sure a lot of others). Thanks -- View this message in context: http://www.nabble.com/Javascript-at-the-bottom-of-page-tp18152871p18152871.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Urgent Problem. After clearing cookies communication between client and tapestry breaks on first request
This fix has addressed my issue, and its now all working as expected :clap:. Cheers, Ben. Sven Homburg wrote: howard commited some changes into tapestry trunk, so the snapshot build starts in some minutes 2008/5/8 Sven Homburg [EMAIL PROTECTED]: lebenski, the snapshot build run at 23:45 centrale european time for faster access, checkout the repository trunk an compile it with mvn clean install 2008/5/8 lebenski [EMAIL PROTECTED]: I have this in my pom: dependency groupIdorg.apache.tapestry/groupId artifactIdt5c-contrib/artifactId version0.5.12-SNAPSHOT/version /dependency dependency groupIdorg.apache.tapestry/groupId artifactIdt5c-commons/artifactId version0.5.12-SNAPSHOT/version /dependency repository idt5components/id nameT5Components Maven Repository/name url http://87.193.218.134:8080/t5components/maven-repository/url /repository And from what I can see, the issue is not fixed for me. As you know, I have to present this tomorrow! Any tips on getting it working would be great. Sven Homburg wrote: i commited a fix into the trunk 2008/5/8 lebenski [EMAIL PROTECTED]: Apparently this message didnt get sent properly last time: Oh I just noticed that you said you found the problem is it because the jsessionid is getting passed on the URL or something else? lebenski wrote: Thanks very much Sven. I appreciate your help on this matter, let me know if I can be of any assistance, I'll be monitoring this thread all day. Ben. Sven Homburg wrote: after a debug session, a find the reason for this behavior. i try to find out a soloution for that 2008/5/8 lebenski [EMAIL PROTECTED]: Yeah that sounds exactly like the problem i'm getting. FYI here is my initial request (onchange of username field) after deleting cookies: URL= http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change;jsessionid=1d4snmum7f5cy/tesusername Second request: URL= http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change/tesusername It appears the jsessionid only gets sent on the URL on the first request (which breaks). However it gets sent in the cookie header both times. The last bit after the slash is the value of the user name field. Sven Homburg wrote: i tested it here in my demo app. if i delete the session cookie the the onevent result is empty even though i refresh the page !?!? 2008/5/8 Sven Homburg [EMAIL PROTECTED]: is there the same behavior if the restart the browser? 2008/5/8 lebenski [EMAIL PROTECTED]: for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. This is exactly what i'm doing. I've also tried this from a fresh, non-dev machine. I hit my server without doing any shenanigans with deleting cookies and I get the same issue %-|. Sven Homburg wrote: thats not correct, the session id ommited by the servlet by every request to the browser so if the user starts the browser and request the www.blabla.com/servletcontext/login or whatever the servlet container response the session id if you delete the cookie or remove the session id from url the server cant handle the ajax request (not sure for that but sounds logical for me) for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. 2008/5/8 lebenski [EMAIL PROTECTED]: I'm replicating the state in which a new user will hit the site, they won't have any of the cookies set by Tapestry. Sven Homburg wrote: why do you delete the cookies ? 2008/5/8 lebenski [EMAIL PROTECTED]: Hi guys, Ok i've got an urgent problem. I'm using tapestry to develop a web app, which I have to present tomorrow to some very important people! I've got a very frustrating problem. I will try to explain it as clearly as possible. I'm using the t5components/OnEvent Mixin to call back to Tapestry 'onChange' of a textfield. TML: t:form t:id=registerBasicForm t:class=gamesysForm zone=registerBasicZone t:label for=registerbasic_userName
T5: Urgent Problem. After clearing cookies communication between client and tapestry breaks on first request
Hi guys, Ok i've got an urgent problem. I'm using tapestry to develop a web app, which I have to present tomorrow to some very important people! I've got a very frustrating problem. I will try to explain it as clearly as possible. I'm using the t5components/OnEvent Mixin to call back to Tapestry 'onChange' of a textfield. TML: t:form t:id=registerBasicForm t:class=gamesysForm zone=registerBasicZone t:label for=registerbasic_userName User Name: /t:label t:textfield t:id=registerbasic_userName t:value=userName event=change onfocus=showFieldHint('4-16 characters');showFieldError('registerbasic_userName');/ /t:form Page Class: @Component(id = registerbasic_userName, parameters = { event=change, onCompleteCallback=checkForServerValidationErrors }) @Mixins(t5components/OnEvent) private TextField userNameField; ... @OnEvent(component = registerbasic_userName, value = change) public JSONObject onChangeFromUserName(String value) { System.out.println(onChangeFromUserName); JSONObject json = new JSONObject(); Boolean userNameExists = false; Pattern p = Pattern.compile(messages.get(alphanumeric-regex)); Matcher m = p.matcher(value); boolean validUserName = m.find(); if (validUserName) { try { userNameExists = hydraService.userNameExists(value); } catch (ServiceFaultException x) { logger.error(fault : + x.getFault().getMessage()); } catch (ServiceProblemException x) { logger.error(problem: + x); } if (userNameExists) { json.put(error, true); json .append(message, Username + value + is taken); } else { json.put(error, false); json.append(message, ); } } else { json.put(error, true); json.append(message, Field contains invalid characters); } json.append(submitid, submitRegisterBasic); json.append(field, registerbasic_userName); System.out.println(json.get(error) + + json.get(field) + + json.get(message)); return json; } Javascript: function checkForServerValidationErrors(response){ var json = response.evalJSON(); var elementId = json.field.toString(); //This MUST be done first performTypeValidation(elementId); if (json!=null json.error == 'true' formErrors[elementId]==null) { addFormValidationError(elementId,json.message); } processValidationErrors(elementId,json.submitid.toString()); } So, what happens is, when the user types a value into 'userName', and exits the field (onChange seems to act like onBlur), it calls back to Tapestry which executes the onChangeFromUserName(String value) method to check if the username exists in the database. This then calls back to the javascript function (defined in the Component annotation) with a JSON object. The javascript is used for client side validation/presentational stuff. This all works fine under normal conditions. HOWEVER, when I clear my cookies and do the same action (type a value into 'username' and tab out), i get a javascript error 'json.field has no properties'. The server side method (onChangeFromUserName) isn't getting called (I can tell because it doesnt hit System.out.println(onChangeFromUserName);), BUT it is calling back to the javascript function. Rightly so, the javascript is complaining because the JSON object hasn't been passed in. 2 cookies are getting set, JSESSIONID and UTRACK, and they do get sent both on the initial request (right after i've cleared my cookies) and the request after. But for some reason, i'm not hitting the server method on the initial request. I have used tamper data to analyse both requests and they appear to be identical. Both cookies are getting sent, all the headers are identical. I am at a real loss and starting to panic about this. I'm starting to think that Tapestry needs a request to properly set up the session, before you can actually call back to it, but
Re: T5: Urgent Problem. After clearing cookies communication between client and tapestry breaks on first request
Yeah that sounds exactly like the problem i'm getting. FYI here is my initial request (onchange of username field) after deleting cookies: URL=http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change;jsessionid=1d4snmum7f5cy/tesusername Second request: URL=http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change/tesusername It appears the jsessionid only gets sent on the URL on the first request (which breaks). However it gets sent in the cookie header both times. The last bit after the slash is the value of the user name field. Sven Homburg wrote: i tested it here in my demo app. if i delete the session cookie the the onevent result is empty even though i refresh the page !?!? 2008/5/8 Sven Homburg [EMAIL PROTECTED]: is there the same behavior if the restart the browser? 2008/5/8 lebenski [EMAIL PROTECTED]: for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. This is exactly what i'm doing. I've also tried this from a fresh, non-dev machine. I hit my server without doing any shenanigans with deleting cookies and I get the same issue %-|. Sven Homburg wrote: thats not correct, the session id ommited by the servlet by every request to the browser so if the user starts the browser and request the www.blabla.com/servletcontext/login or whatever the servlet container response the session id if you delete the cookie or remove the session id from url the server cant handle the ajax request (not sure for that but sounds logical for me) for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. 2008/5/8 lebenski [EMAIL PROTECTED]: I'm replicating the state in which a new user will hit the site, they won't have any of the cookies set by Tapestry. Sven Homburg wrote: why do you delete the cookies ? 2008/5/8 lebenski [EMAIL PROTECTED]: Hi guys, Ok i've got an urgent problem. I'm using tapestry to develop a web app, which I have to present tomorrow to some very important people! I've got a very frustrating problem. I will try to explain it as clearly as possible. I'm using the t5components/OnEvent Mixin to call back to Tapestry 'onChange' of a textfield. TML: t:form t:id=registerBasicForm t:class=gamesysForm zone=registerBasicZone t:label for=registerbasic_userName User Name: /t:label t:textfield t:id=registerbasic_userName t:value=userName event=change onfocus=showFieldHint('4-16 characters');showFieldError('registerbasic_userName');/ /t:form Page Class: @Component(id = registerbasic_userName, parameters = { event=change, onCompleteCallback=checkForServerValidationErrors }) @Mixins(t5components/OnEvent) private TextField userNameField; ... @OnEvent(component = registerbasic_userName, value = change) public JSONObject onChangeFromUserName(String value) { System.out.println(onChangeFromUserName); JSONObject json = new JSONObject(); Boolean userNameExists = false; Pattern p = Pattern.compile(messages.get(alphanumeric-regex)); Matcher m = p.matcher(value); boolean validUserName = m.find(); if (validUserName) { try { userNameExists = hydraService.userNameExists(value); } catch (ServiceFaultException x) { logger.error(fault : + x.getFault().getMessage()); } catch (ServiceProblemException x) { logger.error(problem: + x); } if (userNameExists) { json.put(error, true); json .append(message, Username + value + is taken); } else { json.put(error, false); json.append(message, ); } } else { json.put(error, true); json.append(message, Field contains invalid characters); } json.append
Re: T5: Urgent Problem. After clearing cookies communication between client and tapestry breaks on first request
for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. This is exactly what i'm doing. I've also tried this from a fresh, non-dev machine. I hit my server without doing any shenanigans with deleting cookies and I get the same issue %-|. Sven Homburg wrote: thats not correct, the session id ommited by the servlet by every request to the browser so if the user starts the browser and request the www.blabla.com/servletcontext/login or whatever the servlet container response the session id if you delete the cookie or remove the session id from url the server cant handle the ajax request (not sure for that but sounds logical for me) for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. 2008/5/8 lebenski [EMAIL PROTECTED]: I'm replicating the state in which a new user will hit the site, they won't have any of the cookies set by Tapestry. Sven Homburg wrote: why do you delete the cookies ? 2008/5/8 lebenski [EMAIL PROTECTED]: Hi guys, Ok i've got an urgent problem. I'm using tapestry to develop a web app, which I have to present tomorrow to some very important people! I've got a very frustrating problem. I will try to explain it as clearly as possible. I'm using the t5components/OnEvent Mixin to call back to Tapestry 'onChange' of a textfield. TML: t:form t:id=registerBasicForm t:class=gamesysForm zone=registerBasicZone t:label for=registerbasic_userName User Name: /t:label t:textfield t:id=registerbasic_userName t:value=userName event=change onfocus=showFieldHint('4-16 characters');showFieldError('registerbasic_userName');/ /t:form Page Class: @Component(id = registerbasic_userName, parameters = { event=change, onCompleteCallback=checkForServerValidationErrors }) @Mixins(t5components/OnEvent) private TextField userNameField; ... @OnEvent(component = registerbasic_userName, value = change) public JSONObject onChangeFromUserName(String value) { System.out.println(onChangeFromUserName); JSONObject json = new JSONObject(); Boolean userNameExists = false; Pattern p = Pattern.compile(messages.get(alphanumeric-regex)); Matcher m = p.matcher(value); boolean validUserName = m.find(); if (validUserName) { try { userNameExists = hydraService.userNameExists(value); } catch (ServiceFaultException x) { logger.error(fault : + x.getFault().getMessage()); } catch (ServiceProblemException x) { logger.error(problem: + x); } if (userNameExists) { json.put(error, true); json .append(message, Username + value + is taken); } else { json.put(error, false); json.append(message, ); } } else { json.put(error, true); json.append(message, Field contains invalid characters); } json.append(submitid, submitRegisterBasic); json.append(field, registerbasic_userName); System.out.println(json.get(error) + + json.get(field) + + json.get(message)); return json; } Javascript: function checkForServerValidationErrors(response){ var json = response.evalJSON(); var elementId = json.field.toString(); //This MUST be done first performTypeValidation(elementId); if (json!=null json.error == 'true' formErrors[elementId]==null) { addFormValidationError(elementId,json.message); } processValidationErrors(elementId,json.submitid.toString()); } So, what happens is, when the user types a value into 'userName', and exits the field (onChange seems to act like onBlur), it calls back to Tapestry which executes the onChangeFromUserName(String value) method to check if the username exists in the database. This then calls back to the javascript function (defined in the Component annotation) with a JSON object
Re: T5: Urgent Problem. After clearing cookies communication between client and tapestry breaks on first request
Thanks very much Sven. I appreciate your help on this matter, let me know if I can be of any assistance, I'll be monitoring this thread all day. Ben. Sven Homburg wrote: after a debug session, a find the reason for this behavior. i try to find out a soloution for that 2008/5/8 lebenski [EMAIL PROTECTED]: Yeah that sounds exactly like the problem i'm getting. FYI here is my initial request (onchange of username field) after deleting cookies: URL= http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change;jsessionid=1d4snmum7f5cy/tesusername Second request: URL= http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change/tesusername It appears the jsessionid only gets sent on the URL on the first request (which breaks). However it gets sent in the cookie header both times. The last bit after the slash is the value of the user name field. Sven Homburg wrote: i tested it here in my demo app. if i delete the session cookie the the onevent result is empty even though i refresh the page !?!? 2008/5/8 Sven Homburg [EMAIL PROTECTED]: is there the same behavior if the restart the browser? 2008/5/8 lebenski [EMAIL PROTECTED]: for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. This is exactly what i'm doing. I've also tried this from a fresh, non-dev machine. I hit my server without doing any shenanigans with deleting cookies and I get the same issue %-|. Sven Homburg wrote: thats not correct, the session id ommited by the servlet by every request to the browser so if the user starts the browser and request the www.blabla.com/servletcontext/login or whatever the servlet container response the session id if you delete the cookie or remove the session id from url the server cant handle the ajax request (not sure for that but sounds logical for me) for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. 2008/5/8 lebenski [EMAIL PROTECTED]: I'm replicating the state in which a new user will hit the site, they won't have any of the cookies set by Tapestry. Sven Homburg wrote: why do you delete the cookies ? 2008/5/8 lebenski [EMAIL PROTECTED]: Hi guys, Ok i've got an urgent problem. I'm using tapestry to develop a web app, which I have to present tomorrow to some very important people! I've got a very frustrating problem. I will try to explain it as clearly as possible. I'm using the t5components/OnEvent Mixin to call back to Tapestry 'onChange' of a textfield. TML: t:form t:id=registerBasicForm t:class=gamesysForm zone=registerBasicZone t:label for=registerbasic_userName User Name: /t:label t:textfield t:id=registerbasic_userName t:value=userName event=change onfocus=showFieldHint('4-16 characters');showFieldError('registerbasic_userName');/ /t:form Page Class: @Component(id = registerbasic_userName, parameters = { event=change, onCompleteCallback=checkForServerValidationErrors }) @Mixins(t5components/OnEvent) private TextField userNameField; ... @OnEvent(component = registerbasic_userName, value = change) public JSONObject onChangeFromUserName(String value) { System.out.println(onChangeFromUserName); JSONObject json = new JSONObject(); Boolean userNameExists = false; Pattern p = Pattern.compile(messages.get(alphanumeric-regex)); Matcher m = p.matcher(value); boolean validUserName = m.find(); if (validUserName) { try { userNameExists = hydraService.userNameExists(value); } catch (ServiceFaultException x) { logger.error(fault : + x.getFault().getMessage()); } catch (ServiceProblemException x) { logger.error(problem: + x); } if (userNameExists) { json.put(error, true); json .append(message, Username + value + is taken); } else
Re: T5: Urgent Problem. After clearing cookies communication between client and tapestry breaks on first request
Oh I just noticed that you said you found the problem is it because the jsessionid is getting passed on the URL or something else? Sven Homburg wrote: after a debug session, a find the reason for this behavior. i try to find out a soloution for that 2008/5/8 lebenski [EMAIL PROTECTED]: Yeah that sounds exactly like the problem i'm getting. FYI here is my initial request (onchange of username field) after deleting cookies: URL= http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change;jsessionid=1d4snmum7f5cy/tesusername Second request: URL= http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change/tesusername It appears the jsessionid only gets sent on the URL on the first request (which breaks). However it gets sent in the cookie header both times. The last bit after the slash is the value of the user name field. Sven Homburg wrote: i tested it here in my demo app. if i delete the session cookie the the onevent result is empty even though i refresh the page !?!? 2008/5/8 Sven Homburg [EMAIL PROTECTED]: is there the same behavior if the restart the browser? 2008/5/8 lebenski [EMAIL PROTECTED]: for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. This is exactly what i'm doing. I've also tried this from a fresh, non-dev machine. I hit my server without doing any shenanigans with deleting cookies and I get the same issue %-|. Sven Homburg wrote: thats not correct, the session id ommited by the servlet by every request to the browser so if the user starts the browser and request the www.blabla.com/servletcontext/login or whatever the servlet container response the session id if you delete the cookie or remove the session id from url the server cant handle the ajax request (not sure for that but sounds logical for me) for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. 2008/5/8 lebenski [EMAIL PROTECTED]: I'm replicating the state in which a new user will hit the site, they won't have any of the cookies set by Tapestry. Sven Homburg wrote: why do you delete the cookies ? 2008/5/8 lebenski [EMAIL PROTECTED]: Hi guys, Ok i've got an urgent problem. I'm using tapestry to develop a web app, which I have to present tomorrow to some very important people! I've got a very frustrating problem. I will try to explain it as clearly as possible. I'm using the t5components/OnEvent Mixin to call back to Tapestry 'onChange' of a textfield. TML: t:form t:id=registerBasicForm t:class=gamesysForm zone=registerBasicZone t:label for=registerbasic_userName User Name: /t:label t:textfield t:id=registerbasic_userName t:value=userName event=change onfocus=showFieldHint('4-16 characters');showFieldError('registerbasic_userName');/ /t:form Page Class: @Component(id = registerbasic_userName, parameters = { event=change, onCompleteCallback=checkForServerValidationErrors }) @Mixins(t5components/OnEvent) private TextField userNameField; ... @OnEvent(component = registerbasic_userName, value = change) public JSONObject onChangeFromUserName(String value) { System.out.println(onChangeFromUserName); JSONObject json = new JSONObject(); Boolean userNameExists = false; Pattern p = Pattern.compile(messages.get(alphanumeric-regex)); Matcher m = p.matcher(value); boolean validUserName = m.find(); if (validUserName) { try { userNameExists = hydraService.userNameExists(value); } catch (ServiceFaultException x) { logger.error(fault : + x.getFault().getMessage()); } catch (ServiceProblemException x) { logger.error(problem: + x); } if (userNameExists) { json.put(error, true); json .append(message, Username + value + is taken); } else
Re: T5: Urgent Problem. After clearing cookies communication between client and tapestry breaks on first request
Apparently this message didnt get sent properly last time: Oh I just noticed that you said you found the problem is it because the jsessionid is getting passed on the URL or something else? lebenski wrote: Thanks very much Sven. I appreciate your help on this matter, let me know if I can be of any assistance, I'll be monitoring this thread all day. Ben. Sven Homburg wrote: after a debug session, a find the reason for this behavior. i try to find out a soloution for that 2008/5/8 lebenski [EMAIL PROTECTED]: Yeah that sounds exactly like the problem i'm getting. FYI here is my initial request (onchange of username field) after deleting cookies: URL= http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change;jsessionid=1d4snmum7f5cy/tesusername Second request: URL= http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change/tesusername It appears the jsessionid only gets sent on the URL on the first request (which breaks). However it gets sent in the cookie header both times. The last bit after the slash is the value of the user name field. Sven Homburg wrote: i tested it here in my demo app. if i delete the session cookie the the onevent result is empty even though i refresh the page !?!? 2008/5/8 Sven Homburg [EMAIL PROTECTED]: is there the same behavior if the restart the browser? 2008/5/8 lebenski [EMAIL PROTECTED]: for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. This is exactly what i'm doing. I've also tried this from a fresh, non-dev machine. I hit my server without doing any shenanigans with deleting cookies and I get the same issue %-|. Sven Homburg wrote: thats not correct, the session id ommited by the servlet by every request to the browser so if the user starts the browser and request the www.blabla.com/servletcontext/login or whatever the servlet container response the session id if you delete the cookie or remove the session id from url the server cant handle the ajax request (not sure for that but sounds logical for me) for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. 2008/5/8 lebenski [EMAIL PROTECTED]: I'm replicating the state in which a new user will hit the site, they won't have any of the cookies set by Tapestry. Sven Homburg wrote: why do you delete the cookies ? 2008/5/8 lebenski [EMAIL PROTECTED]: Hi guys, Ok i've got an urgent problem. I'm using tapestry to develop a web app, which I have to present tomorrow to some very important people! I've got a very frustrating problem. I will try to explain it as clearly as possible. I'm using the t5components/OnEvent Mixin to call back to Tapestry 'onChange' of a textfield. TML: t:form t:id=registerBasicForm t:class=gamesysForm zone=registerBasicZone t:label for=registerbasic_userName User Name: /t:label t:textfield t:id=registerbasic_userName t:value=userName event=change onfocus=showFieldHint('4-16 characters');showFieldError('registerbasic_userName');/ /t:form Page Class: @Component(id = registerbasic_userName, parameters = { event=change, onCompleteCallback=checkForServerValidationErrors }) @Mixins(t5components/OnEvent) private TextField userNameField; ... @OnEvent(component = registerbasic_userName, value = change) public JSONObject onChangeFromUserName(String value) { System.out.println(onChangeFromUserName); JSONObject json = new JSONObject(); Boolean userNameExists = false; Pattern p = Pattern.compile(messages.get(alphanumeric-regex)); Matcher m = p.matcher(value); boolean validUserName = m.find(); if (validUserName) { try { userNameExists = hydraService.userNameExists(value); } catch (ServiceFaultException x) { logger.error(fault : + x.getFault().getMessage()); } catch (ServiceProblemException x) { logger.error(problem: + x
Re: Problem with form submission with callback
By using a vanilla Ajax Request wouldn't you be bypassing all the benefits you get from the Tapestry Form Event lifecycle and Tesptry forms in general? Sven Homburg wrote: if your requirement is a login without a page refresh the using of OnEvent is in this case not the right way because OnEvent doesnt know anything about the username and password values. i think the best way is, write your own Ajax.Request script that submits the form values to tapestry 2008/5/8 stuffhere [EMAIL PROTECTED]: It was the only way I could think to do the javascript callback - using onCompleteCallback. I'm pretty new to Tapestry, so most of what I've done has been trial and error, is there a better way to do the callback? -- View this message in context: http://www.nabble.com/Problem-with-form-submission-with-callback-tp17106416p17123069.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- with regards Sven Homburg http://tapestry5-components.googlecode.com - best regards Sven -- View this message in context: http://www.nabble.com/Problem-with-form-submission-with-callback-tp17106416p17125082.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Urgent Problem. After clearing cookies communication between client and tapestry breaks on first request
Thanks Sven, Any info on what was causing the issue? Ben. Sven Homburg wrote: i commited a fix into the trunk 2008/5/8 lebenski [EMAIL PROTECTED]: Apparently this message didnt get sent properly last time: Oh I just noticed that you said you found the problem is it because the jsessionid is getting passed on the URL or something else? lebenski wrote: Thanks very much Sven. I appreciate your help on this matter, let me know if I can be of any assistance, I'll be monitoring this thread all day. Ben. Sven Homburg wrote: after a debug session, a find the reason for this behavior. i try to find out a soloution for that 2008/5/8 lebenski [EMAIL PROTECTED]: Yeah that sounds exactly like the problem i'm getting. FYI here is my initial request (onchange of username field) after deleting cookies: URL= http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change;jsessionid=1d4snmum7f5cy/tesusername Second request: URL= http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change/tesusername It appears the jsessionid only gets sent on the URL on the first request (which breaks). However it gets sent in the cookie header both times. The last bit after the slash is the value of the user name field. Sven Homburg wrote: i tested it here in my demo app. if i delete the session cookie the the onevent result is empty even though i refresh the page !?!? 2008/5/8 Sven Homburg [EMAIL PROTECTED]: is there the same behavior if the restart the browser? 2008/5/8 lebenski [EMAIL PROTECTED]: for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. This is exactly what i'm doing. I've also tried this from a fresh, non-dev machine. I hit my server without doing any shenanigans with deleting cookies and I get the same issue %-|. Sven Homburg wrote: thats not correct, the session id ommited by the servlet by every request to the browser so if the user starts the browser and request the www.blabla.com/servletcontext/login or whatever the servlet container response the session id if you delete the cookie or remove the session id from url the server cant handle the ajax request (not sure for that but sounds logical for me) for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. 2008/5/8 lebenski [EMAIL PROTECTED]: I'm replicating the state in which a new user will hit the site, they won't have any of the cookies set by Tapestry. Sven Homburg wrote: why do you delete the cookies ? 2008/5/8 lebenski [EMAIL PROTECTED]: Hi guys, Ok i've got an urgent problem. I'm using tapestry to develop a web app, which I have to present tomorrow to some very important people! I've got a very frustrating problem. I will try to explain it as clearly as possible. I'm using the t5components/OnEvent Mixin to call back to Tapestry 'onChange' of a textfield. TML: t:form t:id=registerBasicForm t:class=gamesysForm zone=registerBasicZone t:label for=registerbasic_userName User Name: /t:label t:textfield t:id=registerbasic_userName t:value=userName event=change onfocus=showFieldHint('4-16 characters');showFieldError('registerbasic_userName');/ /t:form Page Class: @Component(id = registerbasic_userName, parameters = { event=change, onCompleteCallback=checkForServerValidationErrors }) @Mixins(t5components/OnEvent) private TextField userNameField; ... @OnEvent(component = registerbasic_userName, value = change) public JSONObject onChangeFromUserName(String value) { System.out.println(onChangeFromUserName); JSONObject json = new JSONObject(); Boolean userNameExists = false; Pattern p = Pattern.compile(messages.get(alphanumeric-regex)); Matcher m = p.matcher(value); boolean validUserName = m.find(); if (validUserName) { try { userNameExists = hydraService.userNameExists(value); } catch
Re: T5: Urgent Problem. After clearing cookies communication between client and tapestry breaks on first request
I've just rebuilt my project. I've got this in my pom: repository idt5components/id nameT5Components Maven Repository/name urlhttp://87.193.218.134:8080/t5components/maven-repository/url /repository Should I pick up this change immediately, or will it be added as part of a nightly build? Sven Homburg wrote: i commited a fix into the trunk 2008/5/8 lebenski [EMAIL PROTECTED]: Apparently this message didnt get sent properly last time: Oh I just noticed that you said you found the problem is it because the jsessionid is getting passed on the URL or something else? lebenski wrote: Thanks very much Sven. I appreciate your help on this matter, let me know if I can be of any assistance, I'll be monitoring this thread all day. Ben. Sven Homburg wrote: after a debug session, a find the reason for this behavior. i try to find out a soloution for that 2008/5/8 lebenski [EMAIL PROTECTED]: Yeah that sounds exactly like the problem i'm getting. FYI here is my initial request (onchange of username field) after deleting cookies: URL= http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change;jsessionid=1d4snmum7f5cy/tesusername Second request: URL= http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change/tesusername It appears the jsessionid only gets sent on the URL on the first request (which breaks). However it gets sent in the cookie header both times. The last bit after the slash is the value of the user name field. Sven Homburg wrote: i tested it here in my demo app. if i delete the session cookie the the onevent result is empty even though i refresh the page !?!? 2008/5/8 Sven Homburg [EMAIL PROTECTED]: is there the same behavior if the restart the browser? 2008/5/8 lebenski [EMAIL PROTECTED]: for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. This is exactly what i'm doing. I've also tried this from a fresh, non-dev machine. I hit my server without doing any shenanigans with deleting cookies and I get the same issue %-|. Sven Homburg wrote: thats not correct, the session id ommited by the servlet by every request to the browser so if the user starts the browser and request the www.blabla.com/servletcontext/login or whatever the servlet container response the session id if you delete the cookie or remove the session id from url the server cant handle the ajax request (not sure for that but sounds logical for me) for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. 2008/5/8 lebenski [EMAIL PROTECTED]: I'm replicating the state in which a new user will hit the site, they won't have any of the cookies set by Tapestry. Sven Homburg wrote: why do you delete the cookies ? 2008/5/8 lebenski [EMAIL PROTECTED]: Hi guys, Ok i've got an urgent problem. I'm using tapestry to develop a web app, which I have to present tomorrow to some very important people! I've got a very frustrating problem. I will try to explain it as clearly as possible. I'm using the t5components/OnEvent Mixin to call back to Tapestry 'onChange' of a textfield. TML: t:form t:id=registerBasicForm t:class=gamesysForm zone=registerBasicZone t:label for=registerbasic_userName User Name: /t:label t:textfield t:id=registerbasic_userName t:value=userName event=change onfocus=showFieldHint('4-16 characters');showFieldError('registerbasic_userName');/ /t:form Page Class: @Component(id = registerbasic_userName, parameters = { event=change, onCompleteCallback=checkForServerValidationErrors }) @Mixins(t5components/OnEvent) private TextField userNameField; ... @OnEvent(component = registerbasic_userName, value = change) public JSONObject onChangeFromUserName(String value) { System.out.println(onChangeFromUserName); JSONObject json = new JSONObject(); Boolean userNameExists = false; Pattern p = Pattern.compile(messages.get(alphanumeric-regex
Re: T5: Urgent Problem. After clearing cookies communication between client and tapestry breaks on first request
I have this in my pom: dependency groupIdorg.apache.tapestry/groupId artifactIdt5c-contrib/artifactId version0.5.12-SNAPSHOT/version /dependency dependency groupIdorg.apache.tapestry/groupId artifactIdt5c-commons/artifactId version0.5.12-SNAPSHOT/version /dependency repository idt5components/id nameT5Components Maven Repository/name urlhttp://87.193.218.134:8080/t5components/maven-repository/url /repository And from what I can see, the issue is not fixed for me. As you know, I have to present this tomorrow! Any tips on getting it working would be great. Sven Homburg wrote: i commited a fix into the trunk 2008/5/8 lebenski [EMAIL PROTECTED]: Apparently this message didnt get sent properly last time: Oh I just noticed that you said you found the problem is it because the jsessionid is getting passed on the URL or something else? lebenski wrote: Thanks very much Sven. I appreciate your help on this matter, let me know if I can be of any assistance, I'll be monitoring this thread all day. Ben. Sven Homburg wrote: after a debug session, a find the reason for this behavior. i try to find out a soloution for that 2008/5/8 lebenski [EMAIL PROTECTED]: Yeah that sounds exactly like the problem i'm getting. FYI here is my initial request (onchange of username field) after deleting cookies: URL= http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change;jsessionid=1d4snmum7f5cy/tesusername Second request: URL= http://localhost:8080/home.homepage.registerwidget.registerbasicwidget.registerbasic_username:change/tesusername It appears the jsessionid only gets sent on the URL on the first request (which breaks). However it gets sent in the cookie header both times. The last bit after the slash is the value of the user name field. Sven Homburg wrote: i tested it here in my demo app. if i delete the session cookie the the onevent result is empty even though i refresh the page !?!? 2008/5/8 Sven Homburg [EMAIL PROTECTED]: is there the same behavior if the restart the browser? 2008/5/8 lebenski [EMAIL PROTECTED]: for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. This is exactly what i'm doing. I've also tried this from a fresh, non-dev machine. I hit my server without doing any shenanigans with deleting cookies and I get the same issue %-|. Sven Homburg wrote: thats not correct, the session id ommited by the servlet by every request to the browser so if the user starts the browser and request the www.blabla.com/servletcontext/login or whatever the servlet container response the session id if you delete the cookie or remove the session id from url the server cant handle the ajax request (not sure for that but sounds logical for me) for real testing i think its better to delete the cookie and refresh the page before you initiate the ajax request cycle. 2008/5/8 lebenski [EMAIL PROTECTED]: I'm replicating the state in which a new user will hit the site, they won't have any of the cookies set by Tapestry. Sven Homburg wrote: why do you delete the cookies ? 2008/5/8 lebenski [EMAIL PROTECTED]: Hi guys, Ok i've got an urgent problem. I'm using tapestry to develop a web app, which I have to present tomorrow to some very important people! I've got a very frustrating problem. I will try to explain it as clearly as possible. I'm using the t5components/OnEvent Mixin to call back to Tapestry 'onChange' of a textfield. TML: t:form t:id=registerBasicForm t:class=gamesysForm zone=registerBasicZone t:label for=registerbasic_userName User Name: /t:label t:textfield t:id=registerbasic_userName t:value=userName event=change onfocus=showFieldHint('4-16 characters');showFieldError('registerbasic_userName');/ /t:form Page Class: @Component(id = registerbasic_userName, parameters = { event=change, onCompleteCallback=checkForServerValidationErrors }) @Mixins(t5components/OnEvent) private TextField userNameField
Re: T5: Recording custom validation errors onEvent(blur) on a form field
Sorry for the shameless bump, but I'd really appreciate some help on this. lebenski wrote: Hi everyone, Ok this is what i'm looking for: A user types in their desired username, when the onBlur event happens on that input field (i.e. focus switches to the next field), IF the name is taken i'd like to utilise the standard tapestry validation error bubble, and display a message User Name Taken. This is my solution, which doesn't display the message at all: Page Class (simplified): @Component(id = registerBasicForm) private Form registerBasicForm; @Component private Zone registerBasicZone; @Component(id = registerbasic_userName) @Mixins(t5components/OnEvent) private TextField userNameField; @OnEvent(component = registerbasic_userName, value = blur) public Object onBlurEvent(String value) { System.out.println(onBlurEvent() value: + value); //Hardcoded username for testing purposes if(value.equals(iexist)) { System.out.println(exists); registerBasicForm.recordError(userNameField,that name exists); System.out.println(registerBasicForm.getHasErrors():+registerBasicForm.getHasErrors()); } return registerBasicZone; } public void onValidate() { System.out.println(onValidate()); } public void onValidateForm() { System.out.println(onValidateForm()); } public void onValidateFromUserName(){ System.out.println(onValidateFromUserName()); } public void onSubmit() { System.out.println(onSubmit()); } public Object onSuccess() { System.out.println(onSuccess()); return registerBasicZone; } public Object onFailure() { System.out.println(onFailure()); return registerBasicZone; } public void onSubmitFromRegisterBasicForm() { System.out.println(onSubmitFromRegisterBasicForm()); } TML: t:zone t:id=registerBasicZone visible=true t:form t:id=registerBasicForm t:class=gForm zone=registerBasicZone t:label for=registerbasic_userNameUser Name:/t:label t:textfield t:id=registerbasic_userName t:value=userName event=blur/ br/ t:label for=registerbasic_password1Password:/t:label t:passwordfield t:id=registerbasic_password1 t:value=password1/ br/ t:label for=registerbasic_password2Repeat Password:/t:label t:passwordfield t:id=registerbasic_password2 t:value=password2/ br/ t:label for=registerbasic_emailEmail:/t:label t:textfield t:id=registerbasic_email t:value=email/ br/ t:label for=newsletterSubscribe?/t:label t:checkbox t:id=newsletter t:value=newsletter/ br/ t:label for=termsAgree to terms ?/t:label t:checkbox t:id=terms t:value=terms/ br/ input t:id=submit t:type=Submit t:value=submit / /t:form /t:zone I'm expecting to see the error bubble onBlur(), but is this a correct assumption? I can't find much documentation on recordError, do the errors get added to the form onValidate() maybe? Also is it correct behaviour to return the zone from the onBlurEvent()? I'm quite new to tapestry forms and zones. This is my logging output: onBlurEvent() value: iexist exists registerBasicForm.getHasErrors(): true Any help on this matter would be much appreciated. -- View this message in context: http://www.nabble.com/T5%3A-Recording-custom-validation-errors-onEvent%28blur%29-on-a-form-field-tp16964265p16979086.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: New Validators and server side validation
+1 I would find this functionality extremely useful. Server-side validation onBlur has so many applications. At the moment the solution I have come up with is: 1) Use the T5Components OnEvent annotation, and attach a blur event to the field. 2) Do my server side validation (in this case checking if a username exists in the database) in my page class onBlur method. 3) Callback to a javascript function with a result (true or false, i.e. exists or doesnt exist). 4a) If exists call another function that emulates the tapestry addDecorations function to apply Validation pop up etc to the field. 4b) If doesnt exist, remove decorations if they are present. Its a shame that this isnt properly integrated into the Tapestry validation framework, and I don't get all the benefits like preventing form submission if the form has recorded errors, out of the box. I would approve of the addition of this functionality Mr Lewis-Ship! Cheers, Ben. LakshithaS wrote: I think there is a better option than just using regex for email validation, that is use apache common validator to do the same thing in an easy manner. like EmailValidator.getInstance().isValid(emailAddress); Howard Lewis Ship wrote: I agree: - onblur vs. onform submit - option to validate via server-round trip (especially for onblur) On 5/17/07, kranga [EMAIL PROTECTED] wrote: We just introduced client side validation for Tapestry fields using an ajax call back to the server side (with Tapestry 3). So you only write Java code for the validation and the same code gets called from the client side. All parameters for controlling your validation are automatically sent back as part of the ajax call and you can define when the check is triggered (e.g. onBlur) and which one of the error marker components tied to the input field will show the errors. Makes the code very clean and the front-end experience is slick (e.g. registration page has the same validator to check if username is taken and this is fired from the client and from the server!). I'd suggest T5 move to such a design. - Original Message - From: Bill Holloway [EMAIL PROTECTED] To: Tapestry users users@tapestry.apache.org Sent: Wednesday, May 16, 2007 2:27 PM Subject: Re: T5: New Validators and server side validation That's got it, Ben. Thanks. Wish I knew more about javascript prototyping. Too much technology to stay familiar with. Bill On 5/16/07, Ben Sommerville [EMAIL PROTECTED] wrote: Bill, This pageRenderSupport.addScript( Tapestry.Field.email('%s', %s);, field.getClientId(), quote(buildMessage(formatter, field))); does not construct a function validating emails. What it is doing is inserting a function call to register a particular field for validation. On the page sent to the client you would get something like script language=javascript type=text/javascript !-- Tapestry.registerForm('MyFormId'); Tapestry.Field.email('MyFieldId','My message ')l -- /script That is the source of your error message, the Tapestry.Field.email function does not exist but you are trying to call it. What you need to do is define the email validation function yourself in a javascript file. I would add it to a different namespace so that it is clear it is not a standard Tapestry function. e.g. in myproject-valdation.js var MyProject = {}; MyProject.Field = { email: function(field, message) { Tapestry.addValidator(field, false, function(value, event) { if( X ) { event.recordError(message) } }); } } where is the javascript to test if value is a valid email address. Add a script include to your border/page (to load your validation function) script language=javascript type=text/javascript src=js/myproject-validation.js/script and change the render method to use MyProject.Field.email and you are good to go cheers. -- Ben Sommerville -Original Message- From: Bill Holloway [mailto:[EMAIL PROTECTED] Sent: Wednesday, 16 May 2007 4:33 PM To: Tapestry users Subject: Re: T5: New Validators and server side validation In implementing an e-mail validator myself, one thing I notice in all this is a Javascript error that reads Error: Tapestry.Field.email is not a function... I did some digging and found in org/apache/tapestry/tapestry.js the building up of the Tapestry object has in it a section involving Collection of field based functions related to validation. In that part of the object prototyping (I guess), each of the built-in validation types (required, minlength, maxlength, min, and max) has a function assigned that, essentially, duplicates the functionality of the Java-based
T5: Recording custom validation errors onEvent(blur) on a form field
Hi everyone, Ok this is what i'm looking for: A user types in their desired username, when the onBlur event happens on that input field (i.e. focus switches to the next field), IF the name is taken i'd like to utilise the standard tapestry validation error bubble, and display a message User Name Taken. This is my solution, which doesn't display the message at all: Page Class (simplified): @Component(id = registerBasicForm) private Form registerBasicForm; @Component private Zone registerBasicZone; @Component(id = registerbasic_userName) @Mixins(t5components/OnEvent) private TextField userNameField; @OnEvent(component = registerbasic_userName, value = blur) public Object onBlurEvent(String value) { System.out.println(onBlurEvent() value: + value); //Hardcoded username for testing purposes if(value.equals(iexist)) { System.out.println(exists); registerBasicForm.recordError(userNameField,that name exists); System.out.println(registerBasicForm.getHasErrors():+registerBasicForm.getHasErrors()); } return registerBasicZone; } public void onValidate() { System.out.println(onValidate()); } public void onValidateForm() { System.out.println(onValidateForm()); } public void onValidateFromUserName(){ System.out.println(onValidateFromUserName()); } public void onSubmit() { System.out.println(onSubmit()); } public Object onSuccess() { System.out.println(onSuccess()); return registerBasicZone; } public Object onFailure() { System.out.println(onFailure()); return registerBasicZone; } public void onSubmitFromRegisterBasicForm() { System.out.println(onSubmitFromRegisterBasicForm()); } TML: t:zone t:id=registerBasicZone visible=true t:form t:id=registerBasicForm t:class=gForm zone=registerBasicZone t:label for=registerbasic_userNameUser Name:/t:label t:textfield t:id=registerbasic_userName t:value=userName event=blur/ br/ t:label for=registerbasic_password1Password:/t:label t:passwordfield t:id=registerbasic_password1 t:value=password1/ br/ t:label for=registerbasic_password2Repeat Password:/t:label t:passwordfield t:id=registerbasic_password2 t:value=password2/ br/ t:label for=registerbasic_emailEmail:/t:label t:textfield t:id=registerbasic_email t:value=email/ br/ t:label for=newsletterSubscribe?/t:label t:checkbox t:id=newsletter t:value=newsletter/ br/ t:label for=termsAgree to terms ?/t:label t:checkbox t:id=terms t:value=terms/ br/ input t:id=submit t:type=Submit t:value=submit / /t:form /t:zone I'm expecting to see the error bubble onBlur(), but is this a correct assumption? I can't find much documentation on recordError, do the errors get added to the form onValidate() maybe? Also is it correct behaviour to return the zone from the onBlurEvent()? I'm quite new to tapestry forms and zones. This is my logging output: onBlurEvent() value: iexist exists registerBasicForm.getHasErrors(): true Any help on this matter would be much appreciated. -- View this message in context: http://www.nabble.com/T5%3A-Recording-custom-validation-errors-onEvent%28blur%29-on-a-form-field-tp16964265p16964265.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Client-Side field validation onExit of field Email type validation.
Hi everyone, I'm currently working on a Tapestry 5 project that has several BeanEditForms. I am performing client-side validation on these forms using the @Validate (org.apache.tapestry.beaneditor.Validate) annotation on my form bean class. I'd like to know if it's possible to somehow configure Tapestry (or probably use a convention!) to fire these validation rules onExit of the field i.e. if someone has typed into a 'User Name' field, then tabs or clicks onto the next field it should execute the validation at this point. Currently all validation is being run when the user clicks the 'Submit' button and this isn't really what I'm looking for. Also, are there plans to extend the Validators to include an email validator? Currently the only solution I can see is to apply an email Regex validator rule to the field, can anyone offer a cleaner solution? Thanks, Ben. -- View this message in context: http://www.nabble.com/T5%3A-Client-Side-field-validation-onExit-of-field---Email-type-validation.-tp16939430p16939430.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: CSS Injection and IE Conditional Comments
Hi guys, Does anyone know of a mechanism of utilizing IE Conditional Comments for importing browser-specific CSS, but using the standard tapestry method of css injection via the page class, i.e. something like: private PageRenderSupport _pageRenderSupport; @Inject @Path($path/to/css/default.css) private Asset _defaultStyle; ... _pageRenderSupport.addStylesheetLink(_defaultStyle,null); Cheers, Ben. -- View this message in context: http://www.nabble.com/T5%3A-CSS-Injection-and-IE-Conditional-Comments-tp15504041p15504041.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help! Turning off auto import of prorotype.js from Tapestry JAR
FYI I am using Tapestry 5.0.7-SNAPSHOT. -- View this message in context: http://www.nabble.com/Help%21-Turning-off-auto-import-of-prorotype.js-from-Tapestry-JAR-tp15456459p15456463.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Help! Turning off auto import of prorotype.js from Tapestry JAR
Hi, I have a requirement to remove the auto import of the tapestry bundled version of prototype.js. I am implementing this: http://www.jimbojw.com/wiki/index.php?title=SWFHttpRequest_Flash/Ajax_Utility to facilitate cross-domain javascript. The elegant implementation of this requires a minor change to the getTransport function in prototype.js. Therefore, I need to include my own version of prototype.js in Tapestry pages rather than the Tapestry bundled version. Several hours googling has provided no leads. Can anyone help? Ben. -- View this message in context: http://www.nabble.com/Help%21-Turning-off-auto-import-of-prorotype.js-from-Tapestry-JAR-tp15456459p15456459.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help! Turning off auto import of prorotype.js from Tapestry JAR
This looks great thank you. I am new to Tapestry and can't find the file containing application defaults that you mention. Could you please provide further details about exactly which file I need to modify. Many Thanks, Ben. HugoPalma wrote: I don't think you can remove the inclusion of the prototype.js, but you should be able to change the base path where Tapestry looks for the scriptaculous files enabling you to provide your own implementation. Tapestry adds the tapestry.scriptaculous.path symbol to the factory defaults with the value org/apache/tapestry/scriptaculous_1_8. All you should have to do is contribute the same symbol to application defaults with value you want. lebenski wrote: Hi, I have a requirement to remove the auto import of the tapestry bundled version of prototype.js. I am implementing this: http://www.jimbojw.com/wiki/index.php?title=SWFHttpRequest_Flash/Ajax_Utility to facilitate cross-domain javascript. The elegant implementation of this requires a minor change to the getTransport function in prototype.js. Therefore, I need to include my own version of prototype.js in Tapestry pages rather than the Tapestry bundled version. Several hours googling has provided no leads. Can anyone help? Ben. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Help%21-Turning-off-auto-import-of-prorotype.js-from-Tapestry-JAR-tp15456459p15456837.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help! Turning off auto import of prorotype.js from Tapestry JAR
With a bit of research I answered my own question! Thanks again for your help. lebenski wrote: This looks great thank you. I am new to Tapestry and can't find the file containing application defaults that you mention. Could you please provide further details about exactly which file I need to modify. Many Thanks, Ben. HugoPalma wrote: I don't think you can remove the inclusion of the prototype.js, but you should be able to change the base path where Tapestry looks for the scriptaculous files enabling you to provide your own implementation. Tapestry adds the tapestry.scriptaculous.path symbol to the factory defaults with the value org/apache/tapestry/scriptaculous_1_8. All you should have to do is contribute the same symbol to application defaults with value you want. lebenski wrote: Hi, I have a requirement to remove the auto import of the tapestry bundled version of prototype.js. I am implementing this: http://www.jimbojw.com/wiki/index.php?title=SWFHttpRequest_Flash/Ajax_Utility to facilitate cross-domain javascript. The elegant implementation of this requires a minor change to the getTransport function in prototype.js. Therefore, I need to include my own version of prototype.js in Tapestry pages rather than the Tapestry bundled version. Several hours googling has provided no leads. Can anyone help? Ben. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Help%21-Turning-off-auto-import-of-prorotype.js-from-Tapestry-JAR-tp15456459p15456856.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]