Broetchen1234 / iui

Automatically exported from code.google.com/p/iui
MIT License
0 stars 0 forks source link

Exception in hash used in updatePage function #214

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Define a form that have an html element with name="id"
2. On function updatePage, if the argument page is the form object, when 
access to the id, the code access to the object id and not to the id 
attribute of the same form

What is the expected output? What do you see instead?

- The hash created must use the #_ID form and not the #_[object 
HTMLInputElement]

What version of the product are you using? On what operating system?

- 0.31

Please provide any additional information below.

- I fix the problem changing the follow code (line 339):

    if (!page.id)
        page.id = "__" + (++newPageCount) + "__";

    location.hash = currentHash = hashPrefix + page.id;
    pageHistory.push(page.id);

- To this code (line 339):

    var page_id=page.getAttribute("id");
    if (!page_id)
        page_id = "__" + (++newPageCount) + "__";

    location.hash = currentHash = hashPrefix + page_id;
    pageHistory.push(page_id);

Thanks for your great job.

Original issue reported on code.google.com by josepsan...@gmail.com on 14 Jan 2010 at 11:15

GoogleCodeExporter commented 9 years ago
Why not just use a true id attribute for the form?

Original comment by msgilli...@gmail.com on 18 Jan 2010 at 9:02

GoogleCodeExporter commented 9 years ago
If you have the follow form, the original code work fine:

    <form id="theform" method="post" action="myscript.php">
        <input type="text" name="email" id="email" />
        <input type="text" name="repeatemail" id="repeatemail" />
    </form>

But if you have the follow form, the original code fails and you must use the 
fix 
provided by me:

    <form id="theform" method="post" action="myscript.php">
        <input type="hidden" name="id" value="someid" />
        <input type="text" name="email" id="email" />
        <input type="text" name="repeatemail" id="repeatemail" />
    </form>

I explain the problem of the original code: if the page contain a form and 
exist some 
element with id attribute as id, the page.id access to the id HTMLElement and 
not to 
the id attribute of the form. Is for this reason that the first code work fine 
but 
the second, no.

I use a true id attribute on the form and all cases that not use the id 
HTMLElement 
work fine but if you add a HTMLElement with id attribute as id, the code don't 
work 
as expected.

Original comment by josepsan...@gmail.com on 18 Jan 2010 at 11:03