BUG: insertAdjacentElement() forgets checkbox values
|
|
Thread rating:  |
Mikko Noromaa - 20 May 2005 11:52 GMT Hi,
I have created a dynamic Web page that moves table rows between different tables. There are several elements on the table rows: text, input boxes, checkboxes, select lists, etc. All others work fine except checkboxes. When checkboxes are moved with the insertAdjacentElement() function, they lose their current selection status and revert back to the value they had in the original HTML.
At the end of this post, I have added a sample that demonstrates this behaviour. Use it as follows:
1. Click the "Move Below" button, then the "Move Back" button. Notice now the checkbox and the edit box move below and back above the HR line. This works correctly.
2. Click the checkbox and enter something into the text box. Click the "Move Below" button. Notice how the checkbox forgets the selection and appears unselected but the edit box retains its text.
In this particular case, the problem is easy to work around. I just get the "checked" property of the checkbox right before the insertAdjacentElement() call and set it back to that value afterwards. In my original application, however, I am moving whole table rows with a single insertAdjacentElement() call.
If someone can think of an easier work-around than caching all checkbox values before the insertAdjacentElement() call, I'd appreciate it a lot!
I am using IE 6.0.2900.2180.xpsp_sp2_gdr.050301-1519 on WinXP Pro with SP2 and all updates installed.
Following is the sample HTML:
<HTML> <HEAD> <SCRIPT> function TestMove(ToWhere) { AfterThis=document.all(ToWhere);
el=document.all('Txt2'); AfterThis.insertAdjacentElement('afterEnd', el);
el=document.all('Chk1'); AfterThis.insertAdjacentElement('afterEnd', el); } </SCRIPT> </HEAD>
<BODY> <FORM NAME="Form1"> <SPAN ID="Move2pos"></SPAN> <INPUT TYPE="checkbox" NAME="Chk1"><INPUT TYPE="text" NAME="Txt2" CHECKED> <BR> <BUTTON ONCLICK="TestMove('Move1pos');">Move Below</BUTTON> <HR ID="Move1pos"> <BR> <BUTTON ONCLICK="TestMove('Move2pos');">Move Back</BUTTON> </FORM> </BODY>
</HTML>
--
Mikko Noromaa (mikkon@excelsql.com) - SQL in Excel, check out ExcelSQL! - see http://www.excelsql.com -
Bob Barrows [MVP] - 20 May 2005 16:23 GMT I can reproduce this but I have no workaround. I find no reference to this issue in the KB. Perhaps you should submit this as a bug to MS Product support. You will not be charged if they determine that it is a bug.
Bob Barrows
> Hi, > [quoted text clipped - 59 lines] > > </HTML>
 Signature Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
Nic Roche - 20 May 2005 22:34 GMT Hi,
Same with type="radio"...
> If someone can think of an easier work-around than caching all checkbox > values before the insertAdjacentElement() call, I'd appreciate it a lot! Not really, but the checked value can be persisted to its own custom attribute.
<HTML> <HEAD> <SCRIPT> function TestMove(ToWhere) { AfterThis=document.all(ToWhere);
el=document.all('Txt2'); AfterThis.insertAdjacentElement('afterEnd', el);
el=document.all('Chk1'); el.checkval=el.checked; AfterThis.insertAdjacentElement('afterEnd', el); el.checked=el.checkval; } </SCRIPT> </HEAD>
<BODY> <FORM NAME="Form1"> <SPAN ID="Move2pos"></SPAN> <INPUT TYPE="checkbox" NAME="Chk1" value="on" checkval=""><INPUT TYPE="text" NAME="Txt2"> <BR> <BUTTON ONCLICK="TestMove('Move1pos');">Move Below</BUTTON> <HR ID="Move1pos"> <BR> <BUTTON ONCLICK="TestMove('Move2pos');">Move Back</BUTTON> </FORM> </BODY>
</HTML>
Nic Roche
> Hi, > [quoted text clipped - 64 lines] > Mikko Noromaa (mikkon@excelsql.com) > - SQL in Excel, check out ExcelSQL! - see http://www.excelsql.com - Wei-Dong XU [MSFT] - 23 May 2005 06:33 GMT Hi Mikko,
Thanks for reporting this!
As Bob has suggested, you can raise one incident to your Microsoft local product support service. Your incident will be free of charge when it is confirmed as one bug by the engineer; forthermore, one hotfix may be provided to you then. The Microsoft local PSS is available from: http://support.microsoft.com/common/international.aspx
Please feel free to let me know if you have any question. My pleasure to be of any assistance!
Best Regards, Wei-Dong XU Microsoft Product Support Services This posting is provided "AS IS" with no warranties, and confers no rights.
Mikko Noromaa - 24 May 2005 12:21 GMT Hi,
I should be eligible for support though MSDN Managed Newsgroups. I thought that posting here would get the message to the Microsoft bug database. If that is not the case, please let me know.
--
Mikko Noromaa (mikkon@excelsql.com) - SQL in Excel, check out ExcelSQL! - see http://www.excelsql.com -
> Hi Mikko, > [quoted text clipped - 15 lines] > This posting is provided "AS IS" with no warranties, and confers no > rights. Bob Barrows [MVP] - 24 May 2005 15:34 GMT > Hi, > > I should be eligible for support though MSDN Managed Newsgroups. I > thought that posting here would get the message to the Microsoft bug > database. If that is not the case, please let me know. AFAIK, that is not the case. You need to call Product Support. I hope I'm wrong about this, but I haven't read anything to the contrary.
Bob Barrows
 Signature Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
Mikko Noromaa - 25 May 2005 02:46 GMT Hi,
> AFAIK, that is not the case. You need to call Product Support. I hope I'm > wrong about this, but I haven't read anything to the contrary. I'm not going to bother. I have already worked around the bug, and in my view, already done my part of sharing it with Microsoft. If they cannot get the info from the newsgroup, its their loss.
--
Mikko Noromaa (mikkon@excelsql.com) - SQL in Excel, check out ExcelSQL! - see http://www.excelsql.com -
>> Hi, >> [quoted text clipped - 6 lines] > > Bob Barrows Wei-Dong XU [MSFT] - 25 May 2005 06:37 GMT Hi Mikko,
Thanks a lot for reporting this to Microsoft!
Currently, it is a process for Microsoft to collect the bug at local PSS which will be quick on the bug confirmation and you may receive one hot fix on the bug. If you prefer reporting at the community, I am very willing to record this. And I still remember that I have raised several bugs from you about 1.5 years ago.
Now, I am working on this for you. If any update, I will reply here at the first time.
Greatly appreciate your reporting once more! Have a nice day!
Best Regards, Wei-Dong XU Microsoft Product Support Services This posting is provided "AS IS" with no warranties, and confers no rights.
Mikko Noromaa - 25 May 2005 11:31 GMT Hi,
> If you prefer reporting at the community, I am very willing to > record this. Yes, this would be much easier for me, and I believe for others who use MSDN Managed Newsgroups as well. Thank you for your time!
I have reported bugs to the PSS in the past, but as I recall, I have ended up paying for single-shot support questions that then get refunded. Not so easy! (this might have been with no active MSDN subscription at the time, not sure about that)
--
Mikko Noromaa (mikkon@excelsql.com) - SQL in Excel, check out ExcelSQL! - see http://www.excelsql.com -
> Hi Mikko, > [quoted text clipped - 17 lines] > This posting is provided "AS IS" with no warranties, and confers no > rights. Bob Barrows [MVP] - 25 May 2005 12:25 GMT I'm glad this turned out well for you, but are you aware that, depending on your subscription level, you are entitled to several free support calls as part of your MSDN subscription? Bug reports will not count against the remaining call count.
I have reported bugs via PSS and never been charged.
Bob Barrows
> Hi, > [quoted text clipped - 24 lines] >> >> Greatly appreciate your reporting once more! Have a nice day!
 Signature Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
Wei-Dong XU [MSFT] - 26 May 2005 08:55 GMT Hi Mikko,
I have sent this to product feedback team. The product team will review this and record it following the process. Greatly appreciate your reporting!
And now for reporting bug, I'd suggest that you can dial the phone directly: (800) MICROSOFT (642-7676)
At the phone call, you can confirm the bug case is free and then report it. If you dislike the call, feel free to paste here. I will send the bug to product feedback team.
Have a nice day!
Best Regards, Wei-Dong XU Microsoft Product Support Services This posting is provided "AS IS" with no warranties, and confers no rights.
Danny - 29 May 2005 04:03 GMT Well, just return false on the event, onSOMEEVENHERE="SOMETHINGTODOHERE;return false". Will not flag the object of the event and any objects bubbling from it, won't be processed, as they see no event happening.
Danny
> Hi, > [quoted text clipped - 73 lines] > Mikko Noromaa (mikkon@excelsql.com) > - SQL in Excel, check out ExcelSQL! - see http://www.excelsql.com -
 Signature Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Bob Barrows [MVP] - 31 May 2005 12:30 GMT >> Hi, >> [quoted text clipped - 6 lines] >> they had in the >> original HTML. <snip>
> Well, just return false on the event, > onSOMEEVENHERE="SOMETHINGTODOHERE;return false". Will not flag the > object of the event and any objects bubbling from it, won't be > processed, as they see no event happening. How does that help? Are you replying to the correct message?
Bob Barrows
 Signature Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
|
|
|