You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Paul Stanton (JIRA)" <ji...@apache.org> on 2010/06/08 06:07:10 UTC

[jira] Created: (TAP5-1180) LinkSubmit does nothing

LinkSubmit does nothing
-----------------------

                 Key: TAP5-1180
                 URL: https://issues.apache.org/jira/browse/TAP5-1180
             Project: Tapestry 5
          Issue Type: Bug
          Components: tapestry-core
    Affects Versions: 5.1.0.5
            Reporter: Paul Stanton


After stepping through the javascript, I believe it's because the onsubmit event handler for the form is "javascript:Tapestry.waitForPage(event);" who's first line is "if (Tapestry.pageLoaded) return;".

This is the equivalent of "if (Tapestry.pageLoaded) return false;" when evaluated to a boolean as it is in the LinkSubmit onClick handler:

if (onsubmit == undefined || onsubmit.call(window.document, event))
{
   this.createHidden();
   this.form.submit();
}

.. and therefore "this.form.submit();" is never called.

Obviously this is a bug, I'm pretty sure the resolution would be to change Tapestry.waitForPage so that it returns true if the page is loaded and false otherwise, ie:

waitForPage : function(event)
{
   if (Tapestry.pageLoaded) return true;
   ...
   return false;
}

This will allow 'waitForPage' to be evaluated to a boolean as it is in LinkSubmit.onClick, however there may be a better solution.




EG:

MyPage.tml:
----------------------------------------------------------------------------------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
	<t:form t:id="myForm">
		<t:linksubmit t:id="myLink">link</t:linksubmit>
		<t:submit t:id="mySubmit" />
	</t:form>
</html>
----------------------------------------------------------------------------------------------------------------------------------------------------
MyPage.java
----------------------------------------------------------------------------------------------------------------------------------------------------
 public Class MyPage
{
  public void onSuccessFromMyForm()
   {
       LOG.debug("onSuccessFromMyForm");
   }

   public void onSelectedFromMyLink()
   {
       LOG.debug("onSelectedFromMyLink");
   }

   public void onSelectedFromMySubmit()
   {
       LOG.debug("onSelectedFromMySubmit");
   } 
}
----------------------------------------------------------------------------------------------------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TAP5-1180) LinkSubmit does nothing

Posted by "Paul Stanton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-1180?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Stanton updated TAP5-1180:
-------------------------------


looks like the same as TAP5-930 however he did not describe it properly.

> LinkSubmit does nothing
> -----------------------
>
>                 Key: TAP5-1180
>                 URL: https://issues.apache.org/jira/browse/TAP5-1180
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.1.0.5
>            Reporter: Paul Stanton
>
> After stepping through the javascript, I believe it's because the onsubmit event handler for the form is "javascript:Tapestry.waitForPage(event);" who's first line is "if (Tapestry.pageLoaded) return;".
> This is the equivalent of "if (Tapestry.pageLoaded) return false;" when evaluated to a boolean as it is in the LinkSubmit onClick handler:
> if (onsubmit == undefined || onsubmit.call(window.document, event))
> {
>    this.createHidden();
>    this.form.submit();
> }
> .. and therefore "this.form.submit();" is never called.
> Obviously this is a bug, I'm pretty sure the resolution would be to change Tapestry.waitForPage so that it returns true if the page is loaded and false otherwise, ie:
> waitForPage : function(event)
> {
>    if (Tapestry.pageLoaded) return true;
>    ...
>    return false;
> }
> This will allow 'waitForPage' to be evaluated to a boolean as it is in LinkSubmit.onClick, however there may be a better solution.
> EG:
> MyPage.tml:
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
> 	<t:form t:id="myForm">
> 		<t:linksubmit t:id="myLink">link</t:linksubmit>
> 		<t:submit t:id="mySubmit" />
> 	</t:form>
> </html>
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> MyPage.java
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>  public Class MyPage
> {
>   public void onSuccessFromMyForm()
>    {
>        LOG.debug("onSuccessFromMyForm");
>    }
>    public void onSelectedFromMyLink()
>    {
>        LOG.debug("onSelectedFromMyLink");
>    }
>    public void onSelectedFromMySubmit()
>    {
>        LOG.debug("onSelectedFromMySubmit");
>    } 
> }
> ----------------------------------------------------------------------------------------------------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TAP5-1180) LinkSubmit does nothing

Posted by "Paul Stanton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12876540#action_12876540 ] 

Paul Stanton commented on TAP5-1180:
------------------------------------

i've tested my above idea re returning true from waitForPage and it didn't work.

it seems that 'onsubmit.call(window.document, event)' returns 'undefined' regardless of what the function returns.

therefore my workaround is to comment out the whole if statement in LinkSubmit.onClick:

// if (onsubmit == undefined || onsubmit.call(window.document, event))
{
   this.createHidden();
   this.form.submit();
} 

Having done this, linksubmit works again, however obviously it doesn't handle a premature click properly.

Hope that helps you find the proper solution.

p.

> LinkSubmit does nothing
> -----------------------
>
>                 Key: TAP5-1180
>                 URL: https://issues.apache.org/jira/browse/TAP5-1180
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.1.0.5
>            Reporter: Paul Stanton
>
> After stepping through the javascript, I believe it's because the onsubmit event handler for the form is "javascript:Tapestry.waitForPage(event);" who's first line is "if (Tapestry.pageLoaded) return;".
> This is the equivalent of "if (Tapestry.pageLoaded) return false;" when evaluated to a boolean as it is in the LinkSubmit onClick handler:
> if (onsubmit == undefined || onsubmit.call(window.document, event))
> {
>    this.createHidden();
>    this.form.submit();
> }
> .. and therefore "this.form.submit();" is never called.
> Obviously this is a bug, I'm pretty sure the resolution would be to change Tapestry.waitForPage so that it returns true if the page is loaded and false otherwise, ie:
> waitForPage : function(event)
> {
>    if (Tapestry.pageLoaded) return true;
>    ...
>    return false;
> }
> This will allow 'waitForPage' to be evaluated to a boolean as it is in LinkSubmit.onClick, however there may be a better solution.
> EG:
> MyPage.tml:
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
> 	<t:form t:id="myForm">
> 		<t:linksubmit t:id="myLink">link</t:linksubmit>
> 		<t:submit t:id="mySubmit" />
> 	</t:form>
> </html>
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> MyPage.java
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>  public Class MyPage
> {
>   public void onSuccessFromMyForm()
>    {
>        LOG.debug("onSuccessFromMyForm");
>    }
>    public void onSelectedFromMyLink()
>    {
>        LOG.debug("onSelectedFromMyLink");
>    }
>    public void onSelectedFromMySubmit()
>    {
>        LOG.debug("onSelectedFromMySubmit");
>    } 
> }
> ----------------------------------------------------------------------------------------------------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TAP5-1180) LinkSubmit does nothing

Posted by "Paul Stanton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12876540#action_12876540 ] 

Paul Stanton commented on TAP5-1180:
------------------------------------

i've tested my above idea re returning true from waitForPage and it didn't work.

it seems that 'onsubmit.call(window.document, event)' returns 'undefined' regardless of what the function returns.

therefore my workaround is to comment out the whole if statement in LinkSubmit.onClick:

// if (onsubmit == undefined || onsubmit.call(window.document, event))
{
   this.createHidden();
   this.form.submit();
} 

Having done this, linksubmit works again, however obviously it doesn't handle a premature click properly.

Hope that helps you find the proper solution.

p.

> LinkSubmit does nothing
> -----------------------
>
>                 Key: TAP5-1180
>                 URL: https://issues.apache.org/jira/browse/TAP5-1180
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.1.0.5
>            Reporter: Paul Stanton
>
> After stepping through the javascript, I believe it's because the onsubmit event handler for the form is "javascript:Tapestry.waitForPage(event);" who's first line is "if (Tapestry.pageLoaded) return;".
> This is the equivalent of "if (Tapestry.pageLoaded) return false;" when evaluated to a boolean as it is in the LinkSubmit onClick handler:
> if (onsubmit == undefined || onsubmit.call(window.document, event))
> {
>    this.createHidden();
>    this.form.submit();
> }
> .. and therefore "this.form.submit();" is never called.
> Obviously this is a bug, I'm pretty sure the resolution would be to change Tapestry.waitForPage so that it returns true if the page is loaded and false otherwise, ie:
> waitForPage : function(event)
> {
>    if (Tapestry.pageLoaded) return true;
>    ...
>    return false;
> }
> This will allow 'waitForPage' to be evaluated to a boolean as it is in LinkSubmit.onClick, however there may be a better solution.
> EG:
> MyPage.tml:
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
> 	<t:form t:id="myForm">
> 		<t:linksubmit t:id="myLink">link</t:linksubmit>
> 		<t:submit t:id="mySubmit" />
> 	</t:form>
> </html>
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> MyPage.java
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>  public Class MyPage
> {
>   public void onSuccessFromMyForm()
>    {
>        LOG.debug("onSuccessFromMyForm");
>    }
>    public void onSelectedFromMyLink()
>    {
>        LOG.debug("onSelectedFromMyLink");
>    }
>    public void onSelectedFromMySubmit()
>    {
>        LOG.debug("onSelectedFromMySubmit");
>    } 
> }
> ----------------------------------------------------------------------------------------------------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TAP5-1180) LinkSubmit does nothing

Posted by "Paul Stanton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-1180?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Stanton updated TAP5-1180:
-------------------------------


looks like the same as TAP5-930 however he did not describe it properly.

> LinkSubmit does nothing
> -----------------------
>
>                 Key: TAP5-1180
>                 URL: https://issues.apache.org/jira/browse/TAP5-1180
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.1.0.5
>            Reporter: Paul Stanton
>
> After stepping through the javascript, I believe it's because the onsubmit event handler for the form is "javascript:Tapestry.waitForPage(event);" who's first line is "if (Tapestry.pageLoaded) return;".
> This is the equivalent of "if (Tapestry.pageLoaded) return false;" when evaluated to a boolean as it is in the LinkSubmit onClick handler:
> if (onsubmit == undefined || onsubmit.call(window.document, event))
> {
>    this.createHidden();
>    this.form.submit();
> }
> .. and therefore "this.form.submit();" is never called.
> Obviously this is a bug, I'm pretty sure the resolution would be to change Tapestry.waitForPage so that it returns true if the page is loaded and false otherwise, ie:
> waitForPage : function(event)
> {
>    if (Tapestry.pageLoaded) return true;
>    ...
>    return false;
> }
> This will allow 'waitForPage' to be evaluated to a boolean as it is in LinkSubmit.onClick, however there may be a better solution.
> EG:
> MyPage.tml:
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
> 	<t:form t:id="myForm">
> 		<t:linksubmit t:id="myLink">link</t:linksubmit>
> 		<t:submit t:id="mySubmit" />
> 	</t:form>
> </html>
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> MyPage.java
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>  public Class MyPage
> {
>   public void onSuccessFromMyForm()
>    {
>        LOG.debug("onSuccessFromMyForm");
>    }
>    public void onSelectedFromMyLink()
>    {
>        LOG.debug("onSelectedFromMyLink");
>    }
>    public void onSelectedFromMySubmit()
>    {
>        LOG.debug("onSelectedFromMySubmit");
>    } 
> }
> ----------------------------------------------------------------------------------------------------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.