2

When printing a document, Firefox truncate <fieldset> to one page. This mean that a form with a <fieldset> that would take more than one page in print can not be printed correctly. This is apparently a known bug tracked on bugzilla since 2008 (seebug 471015).

Is there a workaround (CSS or other) that allow printing of a single <fieldset> on several pages ? (other than not using <fieldset>) ?

LapinLove404
  • 1,939
  • 1
  • 21
  • 26
  • Not sure it'll be possible. I know you mentioned you wanted to use a `
    `, but would you be total against just using a `
    ` styled like a `
    `?
    – Alex Mar 29 '11 at 08:52
  • Possible but wouldn't be easy. + I would have to change `legend` for another element styled to look lige `legend`,... – LapinLove404 Mar 29 '11 at 09:03
  • I think it would be fairly easy. This bug is 3 years old, so i dont see many other options... – Alex Mar 29 '11 at 09:10
  • 1
    You just replace html and add a selector to your already existing fieldset style. Not so much work really it's 5 min task :) – easwee Mar 29 '11 at 09:28
  • Since the form are generated via formtastic gem (RoR), this actually means adding rules to change the default code. So it will most probably take more than 5 minutes. – LapinLove404 Mar 29 '11 at 11:17
  • @LapinLove404 Yeah I suspected you would say something like that. – easwee Mar 30 '11 at 11:54
  • Anyway, if there is no workaround, I'll eventually have to take the time for theses changes. – LapinLove404 Mar 30 '11 at 13:13
  • Better solutions are at https://stackoverflow.com/questions/7336586/printing-fieldsets-in-firefox – Pino Jun 16 '17 at 10:16

1 Answers1

1

Check out this jQuery hack I just wrote to solve this issue, figured I'd share even though I'm a year late. You can change "printEnclosure" to an HTML tag I believe and the CSS at the end is obviously optional.

<div id="printEnclosure">
<fieldset>
<legend>TEST</legend>

Test Content goes here...
</fieldset>
</div>

<script type="text/javascript">
/* <![CDATA[ */
$(document).ready(function()
{
        $('#printEnclosure').find('fieldset').each(function(i)
        {
            $(this).replaceWith('<div id="convertedfieldset'+i+'">'+$(this).html()+'</div>');
            $('div#convertedfieldset'+i).css('display','inline').css('text-align','left');
        });
});
/* ]]> */
</script>
Dunstkreis
  • 104
  • 1
  • 7
TheFrack
  • 2,823
  • 7
  • 28
  • 47