|Perl Monk, Perl Meditation|
Tab index feature added to CGI.pmby cbrandtbuffalo (Deacon)
|on Sep 07, 2005 at 19:16 UTC||Need Help??|
cbrandtbuffalo has asked for the wisdom of the Perl Monks concerning the following question:
We recently upgraded many of our Perl modules, including CGI.pm. We then noticed that the tab order in our forms had gone completely crazy. Focus jumped all over the place.
I did a little research, and sitting there in the list of changes for CGI.pm for version 3.06 is the innocent looking:
12. Support for tab indexes.
It appears that CGI.pm now puts tabindex numbers in for all form elements it creates. My problem is that we often create forms that mix HTML and CGI generated form elemenets (in Template Toolkit, for example).
One fix is to always use CGI.pm's methods to create form elements. Another is to never use them. A really bad solution is to try to set tab index around them. I don't really like any of these solutions. Any other suggestions on a work-around?
Also, has anyone else run into this? Should I suggest a pragma to turn this off again? Thanks.
Update: The workaround suggested below to use the -no_xhtml pragma only works for some CGI generated HTML. Some form elements will output the tabindex with xhtml activated or not.
Update:This has been fixed in the newest version of the CGI module. The tabindex feature is now an option and you must explicitly turn it on to make it work. The default behavior is now as it was before. Thanks to Lincoln Stein for fixing this.