tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ville Virtanen <ville.virta...@cerion.fi>
Subject Re: The Form Submit can't Work!
Date Mon, 01 Dec 2008 09:43:17 GMT

Hi,

this is one of the bad sides of T5: there is nothing wrong in your code, but
the correct method handler should be named onSuccessFromDownloadFile() I
think, not onSuccessFormDownloadFile.

The notation is onSOMEEVENTFromSOMECOMPONENTID when you use that approach. I
prefer the annotations though.

Here you can see the possible events that form invokes:

http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Form.html

(scroll to the submit events part.)

for an example if you want your method to be called when there is a
validation failure write

onFailureFromDownloadFile() 

and if you want to execute only when there are no validation errors use 

onSuccessFromDownloadFile()

submit event will fire regardless whether there are validation errors or
not.

 - Ville


Gerry Chen wrote:
> 
> Thank dalahoo !
> 
> I use T5.0.16 JAR.I try your codes in my project .But I find it not to
> work.I try to insert a Breakpoint in the "onSuccessFormDownloadFile()" .It
> doesn't stop in the method after my clicking "Export File" Button. 
> 
> I have tried to add below code.
> 
> StreamResponse onSubmit()
> {
> .......
> }
> 
> I find it can work.
> 
> I think I can't  make out the method invoked by "Btn_Down" or "Btn_Search"
> when we click buttons in my Page .Though I can add a private property to
> distinguish the method invoked by which Botton in my Page,I think it is so
> tired to handle the click event.
> 
> So Everyone have some suggestion to me.
> 
> Thanks!
> 
> 
> 
>  
> 
> dalahoo wrote:
>> 
>> Hi Gerry,
>> 
>> Try to change you method name to : onSuccessFormDownloadFile
>> 
>> or use Annotation  :
>> 
>> @OnEvent(value = "submit", component = "Btn_Down")
>> StreamResponse onSubmitFormDownloadFile() {
>> ....
>> 
>> 
>> 
>> 
>> 
>> On Mon, Dec 1, 2008 at 2:55 AM, Gerry Chen <kongxingzhu001@163.com>
>> wrote:
>> 
>>>
>>> Hi Everyone:
>>>
>>>   I'm a new Tapestry user. I'm interesting in developing Web Program
>>> with
>>> Tapestry Framwork.But I have some problem in my project.
>>>  This question is the Form Submit Event can't be invoked When I click
>>> "Export File" Button in my Page.
>>>
>>>  My Program looks like this:
>>>
>>>  SearchGoodsInfo.tml
>>>
>>>  This tml file hava tow Forms.
>>>
>>>  <t:Form id="queryForm">
>>>         <input type="submit" t:type="submit" t:Id="Btn_Search"
>>> t:value="Find" class="button_bg"/>
>>>  </t:Form>
>>>
>>>  <t:Form t:id="DownloadFile">
>>>                <input type="submit" t:type="submit" t:Id = "Btn_Down"
>>> t:value="Export File" class="button_bg"/>
>>>  </t:Form>
>>>
>>>   SearchGoodsInfo.java
>>>
>>>   The Event handler in java file like this:
>>>
>>>   StreamResponse onSubmitFormDownloadFile()
>>>  {
>>>
>>>    ........
>>>    StreamResponse responseDown = new XlsFileAttachmet(insFile);
>>>    return responseDown;
>>>
>>>  }
>>>
>>>  The Extension .java file only have a form submit Event with "Export
>>> File"
>>> Button.I use below code to handle another button. That is working
>>> finely.
>>>
>>>   @OnEvent(value="selected",component = "Btn_Submit")
>>>   public void onSearch()
>>>  {
>>>    .........
>>>  }
>>>
>>>
>>>  But the onSubmitFormDownloadFile method can not work!How can I catch
>>> the
>>> "DownloadFile" form submit event.
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/The-Form-Submit-can%27t-Work%21-tp20765310p20765310.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>> 
>> 
>> -- 
>> sincerely yours
>> M. H. Shamsi
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/The-Form-Submit-can%27t-Work%21-tp20765310p20768836.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Mime
View raw message