T5: Submit Button in Custom Component, Form in Page

2009-11-26 Thread CarmenG

I have a page with a form, nested within the form is a custom component with
a select box and a submit button. When the submit button is clicked I want
to download either a PDF or Excel file based on the value of the select box.

I know the event for the submit button cannot return a value and I don't
know how the page's onSuccess event can notify the custom component to
download the file, or if it should be done another way. 

I'm new to Tapestry 5 but have used Tapestry 4 and previously 3 for many
years.

thanks,
Carmen
-- 
View this message in context: 
http://old.nabble.com/T5%3A-Submit-Button-in-Custom-Component%2C-Form-in-Page-tp26535560p26535560.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: Submit Button in Custom Component, Form in Page

2009-11-26 Thread CarmenG

Sorry Uli that doesn't help me as the onSelected event cannot return a value,
the download file in my case. Can you elobarate a bit more?

What I have read so far have only been examples of Forms and Submit
components on the same page/component where you would have 


private String type;  // Value assigned to select component.
private String selectedType;

public void onSelectedFromDownload() {
selectedType = type;
}

public Object onSuccess() {
if (selectedType != null) {
return XYZ;  // StreamResponse of file for selected
type.
}
}

In my case onSelectedFromDownload and onSuccess are in 2 different classes,
how do I get onSuccess from the page class to notify the custom component to
download the file? 

The quick and dirty hack that I used was to add selectedType as a parameter
of the custom component so the value was available to the custom component
and the page, but I really do not like this solution. The custom component
should handle the downloading of the file, as it did in Tapestry 4.

Any other ideas on what I can do?

thanks,
Carmen
-- 
View this message in context: 
http://old.nabble.com/T5%3A-Submit-Button-in-Custom-Component%2C-Form-in-Page-tp26535560p26535821.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