You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Simon Kitching (JIRA)" <de...@myfaces.apache.org> on 2008/01/20 16:36:34 UTC

[jira] Commented: (MYFACES-1805) form stopped working after ajax request

    [ https://issues.apache.org/jira/browse/MYFACES-1805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12560811#action_12560811 ] 

Simon Kitching commented on MYFACES-1805:
-----------------------------------------

Hmm..I just started adding some minor comments to the source to mark this changed as an "ie compatibility hack". But then I looked again.

 presume the problem is that this line didn't work without the modification..
        context.append("if(typeof form.elements[name]=='undefined')");

But this code looks suspect to me. Where is it stated that the form.elements collection can be indexed using the name *or* id of an element?

According to the w3 spec, HTMLFormElement.elements is just an HTMLCollection type, ie a list not a map:
   http://www.w3.org/TR/REC-DOM-Level-1/level-one-html.html#ID-798055546
   (search for HTMLFormElement)

In javascript, there are of course no lists so the list is represented as an array that can be indexed using an integer.
But what happens when it is indexed using a non-integer? That seems to me to not be part of the w3 dom spec at all.

I think that the change that Mario made to add the id to the component is good, but that in addition this line of javascript should be changed to be
  if (typeof document.getElementById(id)=='undefined')
instead of using the form.elements collection, which is theoretically a list and not a map AFAICT.

The w3schools page also uses this only as a list:
  http://w3schools.com/htmldom/coll_form_elements.asp

Comments?


> form stopped working after ajax request
> ---------------------------------------
>
>                 Key: MYFACES-1805
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1805
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 1.1.5,  1.2.0
>            Reporter: Mario Ivankovits
>             Fix For:  1.1.6-SNAPSHOT, 1.2.2-SNAPSHOT
>
>
> In a little bit complicated form using multiple PPR areas the datascroller attached to a datatable stopped working with InternetExplorer after the first ajax request.
> MyFaces always sent the current page again.
> It turned out that the code in oamSetHiddenInput is not fully compatible with InternetExplorer.
> The problem is that even after adding the element to the form using javascript the check for it (typeof form.elements[name]=='undefined') still returns undefined.
> After setting the id of the created element (beside of it's name) fixed this problem.

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