Re: Persist variable being lost

2012-03-09 Thread Thiago H. de Paula Figueiredo

Hi!

Your code and template weren't posted to the mailing list. Here's one  
method:


public Object onSubmitFromRequestForm() {

if (requestForm.isValid()) {
alertManager.alert(Duration.TRANSIENT, Severity.INFO, 
"Request Sent");
return myOtherPage;
} else {
return this;
}
}

Never return "this" in event handler methods: return null instead. In  
onSubmitFromRequestForm, you're causing a redirect to the same page  
instead of letting it run normally. I don't know if this will solve your  
problem, but that's something you shouldn't do anyway.


Two additional comments:

* You don't need to use the Submit component for form submissions at all.  
You just need to use it when you have more than one submit button in order  
to know which one was clicked.


* Do validations in the validate event of Form.


On Fri, 09 Mar 2012 19:02:26 -0300, Seamus  wrote:

So I have a page which is basically just updating three persisted  
variables.

(Code below). One is being updated when a user changes selection on a
 input  (selectedNode). One is a string when a user enters text  
in a
simple text field (nodeNameValue). The last is a string I am  
manipulating in

the code (parentPath).

The select and parentPath are in a zone so when the user changes the  
select

it updates both.

This works fine and when setting a breakpoint in the onValueChanged I can
see all 3 variables hold what I expect. The problem is when I click the
submit button selectedNode is null and all the others are exactly as I  
would

expect.

This is an application written with Tapestry 5.3.2. I am thinking its  
some

odd behavior from the Zone? Probably not a bug just that I am doing
something wrong. I have put in a work around (hack) but would really  
like to

understand what my mistake is.

TML:


Java:



For the GenericSelectModel The source can be found:
http://jumpstart.doublenegative.com.au/jumpstart/examples/select/easyobject

--
View this message in context:  
http://tapestry.1045711.n5.nabble.com/Persist-variable-being-lost-tp5551835p5551835.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




--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate
http://www.arsmachina.com.br

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



Persist variable being lost

2012-03-09 Thread Seamus
So I have a page which is basically just updating three persisted variables.
(Code below). One is being updated when a user changes selection on a
 input  (selectedNode). One is a string when a user enters text in a
simple text field (nodeNameValue). The last is a string I am manipulating in
the code (parentPath).

The select and parentPath are in a zone so when the user changes the select
it updates both.

This works fine and when setting a breakpoint in the onValueChanged I can
see all 3 variables hold what I expect. The problem is when I click the
submit button selectedNode is null and all the others are exactly as I would
expect.

This is an application written with Tapestry 5.3.2. I am thinking its some
odd behavior from the Zone? Probably not a bug just that I am doing
something wrong. I have put in a work around (hack) but would really like to
understand what my mistake is.

TML:


Java:



For the GenericSelectModel The source can be found:
http://jumpstart.doublenegative.com.au/jumpstart/examples/select/easyobject

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Persist-variable-being-lost-tp5551835p5551835.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