myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Marinschek (JIRA)" <myfaces-...@incubator.apache.org>
Subject [jira] Commented: (MYFACES-401) CommandLink tag override onsubmit function of Form
Date Tue, 20 Sep 2005 23:08:30 GMT
    [ http://issues.apache.org/jira/browse/MYFACES-401?page=comments#action_12330052 ] 

Martin Marinschek commented on MYFACES-401:
-------------------------------------------

As I see it, Zhong Li is right - you would need to check for onsubmit to return true to really
submit the form - so you need exactly his code.

Paul, why would you leave his if clause out?

regards,

Martin

> CommandLink tag override onsubmit function of Form
> --------------------------------------------------
>
>          Key: MYFACES-401
>          URL: http://issues.apache.org/jira/browse/MYFACES-401
>      Project: MyFaces
>         Type: Bug
>   Components: Implementation
>     Versions: 1.1.0
>  Environment: Tomcat 5.0.28
>     Reporter: Zhong Li
>     Assignee: Martin Marinschek
>     Priority: Critical
>  Attachments: bugfix_myfaces-401.txt
>
> I have java script onsubmit in <h:form>, when I use commandLink tag, even onsubmit
return false, the form still submitted. I checked javasctipt, If I am right, the bug should
be here,
> JSF generate Javascript for each commandLink like,
> clear_unitItemViewList();
> document.forms['unitItemViewList'].elements['autoScroll'].value=getScrolling();
> document.forms['unitItemViewList'].elements['unitItemViewList:_link_hidden_'].value='unitItemViewList:_id49_0:_id72';
> if(document.forms['unitItemViewList'].onsubmit){document.forms['unitItemViewList'].onsubmit();}
> document.forms['unitItemViewList'].submit();
> return false;
> ----------------------
> so problem it will be caused by 
> if(document.forms['unitItemViewList'].onsubmit){document.forms['unitItemViewList'].onsubmit();}
> document.forms['unitItemViewList'].submit(); //the form submitted!!!!!!
> it should be 
> if(document.forms['unitItemViewList'].onsubmit)
> {
>     if( document.forms['unitItemViewList'].onsubmit() )
>     {
>        document.forms['unitItemViewList'].submit();
>     }
> }
> else
> {
>    document.forms['unitItemViewList'].submit();
> }

-- 
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


Mime
View raw message