« 7 Buttons Mouse in Linux | Main | Diagnosing Problems with the Visual Editor Not Rendering JSF Pages. »

Multiple Checkbox Selection in UIX Fails with JavaScript Error in Internet Explorer


The Problem


Your UIX page includes a Multi-Selection table with a high number of checkboxes that are checked
When you submit the page, it fails with a JavaScript error in Internet Explorer:

"Error on page." is displayed in the left low corner of the Internet Explorer.
If you double-click there, the IE Javascript error dialog pops up with the following:

Line: 2664
Char: 1
Error: Invalid syntax
Code: 0
URL: http://127.0.0.1:8989/<workspace>-ViewController-context-root/<uix_page>.uix

The same page works properly in other browsers.


The Cause


By default, the FORM tag in UIX uses the method="GET".
That means that the fields of your Form are added to the URL with the following format:

TableName%3Aselected%3A0=0&myTable%3Aselected%3A1=1%3...

The text copied above is only for 2 checkboxes.
So the length of the URL is increased by at least:

number of checkboxes * length of table name.

Internet Explorer has a limit of 2.083 characters

See document "INFO: Maximum URL Length Is 2,083 Characters in Internet Explorer"
Because of this limitation in the length of the URL, the browser has a problem.
You can check it by running the utility ieHttpHeaders, when running your UIX page:
  1. when <table name="myTable">
    URL length = 2.279 bytes
    GET /.../table.uix?myTable%3Aselected%3A0=0&myTable%3Aselected%3A1=1&myTable%3Aselected%3A2=2&...
  2. when <table name="myVeryVeryVeryLongTable">
    URL length = 3591 bytes
    GET  /.../table.uix?myVeryVeryVeryLongTable%3Aselected%3A0=0&myVeryVeryVeryLongTable%3Aselected%3A1=1&...

NB: utility ieHttpHeaders can be downloaded from [Here]

The Solution


  1. Either reduce the length of the URL, by decreasing the number of checkboxes, and/or reducing the length of the table name;
    for example, if you name your table "a" instead of table "myTable", you'll gain
    80 * 6 (difference of characters) = 480 characters
    You should insure that the length of your URL is less than 2.083 characters

  2. or use the POST method by adding method="POST" in your FORM tag, as the following:
    <form name="tableForm" method="POST">
    POST is not limited by the size of the URL for submitting name/value pairs, because they are transferred in the header and not the URL.


Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on February 14, 2007 11:41 AM.

The previous post in this blog was 7 Buttons Mouse in Linux.

The next post in this blog is Diagnosing Problems with the Visual Editor Not Rendering JSF Pages..

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle