myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Marinschek <martin.marinsc...@gmail.com>
Subject Re: [jira] Commented: (MYFACES-755) HTML links "onclick" - if "onsubmit" function exists, it's required to explicitly return "true" (returning nothing considered as "false" and clicking the link doesn't submit the form)
Date Tue, 15 Nov 2005 10:30:28 GMT
Strange. I just did a complete update, dist-all and it worked?

regards,

Martin

On 11/15/05, Peter Mahoney (JIRA) <dev@myfaces.apache.org> wrote:
>     [ http://issues.apache.org/jira/browse/MYFACES-755?page=comments#action_12357681
]
>
> Peter Mahoney commented on MYFACES-755:
> ---------------------------------------
>
> I cannot currently build from SVN as, I get the following error:
>
>      [xslt] : Fatal Error! java.io.FileNotFoundException: C:\workspace\myfaces\tomahawk\tld\entities\ext_escape_attribute.xml
(The system cannot find the file specified) Cause: java.io.FileNotFoundException: C:\workspace\myfaces\tomahawk\tld\entities\ext_escape_attribute.xml
(The system cannot find the file specified)
>
> ext_escape_attribute.xml exists in impl/tld/entities not tomahawk\tld\entities
>
> > HTML links "onclick" - if "onsubmit" function exists, it's required to explicitly
return "true" (returning nothing considered as "false" and clicking the link doesn't submit
the form)
> > ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> >
> >          Key: MYFACES-755
> >          URL: http://issues.apache.org/jira/browse/MYFACES-755
> >      Project: MyFaces
> >         Type: Bug
> >   Components: Implementation
> >     Versions: 1.1.1
> >  Environment: Windows XP, SP2
> >     Reporter: Evgeny Goldin
> >     Assignee: Martin Marinschek
> >      Fix For: Nightly
>
> >
> > Hello,
> > We're using MyFaces-1.1.1RC3.
> > The HTML link's "onclick" rendered by org.apache.myfaces.renderkit.html.HtmlLinkRendererBase#renderJavaScriptAnchorStart
goes as following:
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > if ( document.forms['id'].onsubmit )
> > {
> >       if( document.forms['id'].onsubmit()) document.forms['id'].submit();
> > }
> > else
> > {
> >       document.forms['id'].submit();
> > }
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Which means "If form has 'onsubmit' handler and it's return value is 'true' - submit
the form". But it should be the other way around - "If form has 'onsubmit' handler and it's
return value is 'false' -don't submit the form".
> > The difference shows up if "onsubmit" handler returns nothing and return value of
calling"onsubmit() is "undefined" - in this case "if ( form.onsubmit())" doesn't hold true
and "form.submit()" isn't called. The result - you have a form with "onsubmit" handler returning
no value (it's perfectly Ok) with non-working links, i.e clicking them causes no effect.
> > I believe the JavaScript code should be written in the following way:
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > if ( document.forms['id'].onsubmit )
> > {
> >         var result = document.forms['id'].onsubmit();
> >       if( isUndefined( result ) || result ) document.forms['id'].submit();
> > }
> > else
> > {
> >       document.forms['id'].submit();
> > }
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > So far - we've just made our "onsubmit" handler to return "true" explicitly.
> > Thank you !
>
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
>    http://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see:
>    http://www.atlassian.com/software/jira
>
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Mime
View raw message