WWW

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • even rows for checkbox forms with no splitting of boxes from values

    7 answers - 1821 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Dear everyone: I have an application where a script creates a number of
    strings which then need to be passed via a 'checkbox' form to a subsequent
    script for further workup. I have no idea ahead of time how many strings
    will be created, or how many characters will be in each one, except I know
    the latter will be
    2-10. I have worked up a bogus script which may make the problem clear:
    #!/usr/bin/perl -wT
    use strict;
    use CGI::Carp qw(fatalsToBrowser);
    use CGI qw(:standard -no_xhtml);
    use diagnostics;
    my $co = new CGI;
    print $co->header;
    print $co->start_html(-title=>'uneven');
    #set up uneven array:
    my @matches=qw(abcd efgh ijkl mnop qrst uvwx AGCD EEEEFGH IJKL MNP
    PRST UWWX A111
    B2222 C333 D444 E555 F666 G222777 H8888 I9999 J10000 KKK LLL MMM
    ABCD EFGH
    KJKL MNNP RRST UVWX YZAB CEEF GIIJ KMMN PPQR SSUV XXYZ BCDE FGHI
    JKLM
    NPQ RSTU VWXY ZABC DEFG HIJK LMN QRST RVWX YTAB CDEF GHIJ KLMN
    PQR STUV WXYZ);
    #next let's set up a form with all members from the array
    print $co->start_form(-method=>"PST",-action=>"findme.html");
    @matches=sort(@matches);
    #eliminate duplicates in array @matches:
    my %temp=();
    @matches=grep ++$temp{$_}<2, @matches;
    my $lenmatches=@matches;
    print $co->p,$co->checkbox_group(-name=>'onlyd', -Values=>\@matches);
    print $co->p,$co->submit,$co->endform;
    The problem is the form returns end-of-lines some of which are the box
    alone, with the 'match' array variable on the next line:
    If I could split up @matches into shorter ones it would work, but I don't
    know how to pass multiple variables to the checkbox. Does anyone know what
    to do?
    As always, thanks in advance.
    mike
  • No.1 | | 3354 bytes | |

    Dear everyone: I find when looking at my post from last night that the
    problem was not illustrated in the checkbox line: the square checkboxes
    never showed up! If you wish to help out, please run the script enclosed in
    the message:

    #!/usr/bin/perl -wT
    use strict;
    use CGI::Carp qw(fatalsToBrowser);
    use CGI qw(:standard -no_xhtml);
    use diagnostics;
    my $co = new CGI;
    print $co->header;
    print $co->start_html(-title=>'uneven');
    #set up uneven array:
    my @matches=qw(abcd efgh ijkl mnop qrst uvwx AGCD EEEEFGH IJKL MNP
    PRST UWWX A111
    B2222 C333 D444 E555 F666 G222777 H8888 I9999 J10000 KKK LLL MMM
    ABCD EFGH
    KJKL MNNP RRST UVWX YZAB CEEF GIIJ KMMN PPQR SSUV XXYZ BCDE FGHI
    JKLM
    NPQ RSTU VWXY ZABC DEFG HIJK LMN QRST RVWX YTAB CDEF GHIJ KLMN
    PQR STUV WXYZ);
    #next let's set up a form with all members from the array
    print $co->start_form(-method=>"PST",-action=>"findme.html");
    @matches=sort(@matches);
    #eliminate duplicates in array @matches:
    my %temp=();
    @matches=grep ++$temp{$_}<2, @matches;
    my $lenmatches=@matches;
    print $co->p,$co->checkbox_group(-name=>'onlyd', -Values=>\@matches);
    print $co->p,$co->submit,$co->endform;
    Having the checkboxes on one line and their 'values' on the next is
    disconcerting for the user. Thank you.

    "mike" <rallabs@adelphia.netwrote in message
    @adelphia.com
    Dear everyone: I have an application where a script creates a number of
    strings which then need to be passed via a 'checkbox' form to a
    subsequent script for further workup. I have no idea ahead of time how
    many strings will be created, or how many characters will be in each one,
    except I know the latter will be
    2-10. I have worked up a bogus script which may make the problem clear:

    #!/usr/bin/perl -wT
    use strict;
    use CGI::Carp qw(fatalsToBrowser);
    use CGI qw(:standard -no_xhtml);
    use diagnostics;
    my $co = new CGI;
    print $co->header;
    print $co->start_html(-title=>'uneven');
    #set up uneven array:
    my @matches=qw(abcd efgh ijkl mnop qrst uvwx AGCD EEEEFGH IJKL MNP
    PRST UWWX A111
    B2222 C333 D444 E555 F666 G222777 H8888 I9999 J10000 KKK LLL MMM
    ABCD EFGH
    KJKL MNNP RRST UVWX YZAB CEEF GIIJ KMMN PPQR SSUV XXYZ BCDE FGHI
    JKLM
    NPQ RSTU VWXY ZABC DEFG HIJK LMN QRST RVWX YTAB CDEF GHIJ KLMN
    PQR STUV WXYZ);
    #next let's set up a form with all members from the array
    print $co->start_form(-method=>"PST",-action=>"findme.html");
    @matches=sort(@matches);
    #eliminate duplicates in array @matches:
    my %temp=();
    @matches=grep ++$temp{$_}<2, @matches;
    my $lenmatches=@matches;
    print $co->p,$co->checkbox_group(-name=>'onlyd', -Values=>\@matches);
    print $co->p,$co->submit,$co->endform;

    The problem is the form returns end-of-lines some of which are the box
    alone, with the 'match' array variable on the next line:

    If I could split up @matches into shorter ones it would work, but I don't
    know how to pass multiple variables to the checkbox. Does anyone know
    what to do?

    As always, thanks in advance.
    mike
    >
    >
    >
  • No.2 | | 710 bytes | |

    Mike,

    I ran your revised script. Even when resizing my screen many times, the
    checkboxes and text remained on the same line.
    You may want to force the number of checkbox rows or columns in your
    checkbox_group function to improve your format.

    Try
    print
    $co->p,$co->checkbox_group(-name=>'onlyd', -Values=>\@matches, -columns=>5 );

    Tom

    "mike" <rallabs@adelphia.netwrote in message
    @adelphia.com
    Dear everyone: I find when looking at my post from last night that the
    problem was not illustrated in the checkbox line: the square checkboxes
    never showed up! If you wish to help out, please run the script enclosed
    in the message:
  • No.3 | | 1410 bytes | |

    Tom:
    It depends upon the browser! I'm new to this, so I was unaware that this
    was an issue, but running my script with Firefox v1.5.0.2 gives broken
    strings which wrap, but IE gives nice, clean, even lines. Using
    '-columns=>5' didn't work for either browser, ufortunately. I'd rather not
    have to ask the users to employ a particular browser. Does anyone know how
    to tell Firefox to act like Internet Explorer? make Firefox behave?
    Thank you for the help.

    "Tom" <tom@sygration.comwrote in message
    news:%FM5g.983$VV2.74286@news20.bellglobal.com
    Mike,

    I ran your revised script. Even when resizing my screen many times, the
    checkboxes and text remained on the same line.
    You may want to force the number of checkbox rows or columns in your
    checkbox_group function to improve your format.

    Try
    print
    $co->p,$co->checkbox_group(-name=>'onlyd', -Values=>\@matches, -columns=>5
    );

    Tom

    "mike" <rallabs@adelphia.netwrote in message
    @adelphia.com
    >Dear everyone: I find when looking at my post from last night that the
    >problem was not illustrated in the checkbox line: the square checkboxes
    >never showed up! If you wish to help out, please run the script enclosed
    >in the message:
    >>

    >
  • No.4 | | 2133 bytes | |


    mike wrote:
    Tom:
    It depends upon the browser! I'm new to this, so I was unaware that this
    was an issue, but running my script with Firefox v1.5.0.2 gives broken
    strings which wrap, but IE gives nice, clean, even lines. Using
    '-columns=>5' didn't work for either browser, ufortunately. I'd rather not
    have to ask the users to employ a particular browser. Does anyone know how
    to tell Firefox to act like Internet Explorer? make Firefox behave?

    RTFLWTIME. If you find a suitable way to do this then let us all
    know. I don't know how many times I've read on how you have to hack
    html to get it to look like the same in all browsers. Especially if
    your using CSS. All we can hope is that IE7 is supposed to act like a
    standards compliant browser like Firefox. But I am using the Beta and
    I'm not seeing this to be true so far.

    Good luck with that.

    I'll have to take a closer look at your sample script and see if I can
    come up with anything. Maybe in another post. My imediate sugestion
    is make a mock-up of what you want it to look like in HTML and then
    model that in your perl.

    Thank you for the help.
    --
    "Tom" <tom@sygration.comwrote in message
    news:%FM5g.983$VV2.74286@news20.bellglobal.com
    Mike,

    I ran your revised script. Even when resizing my screen many times, the
    checkboxes and text remained on the same line.
    You may want to force the number of checkbox rows or columns in your
    checkbox_group function to improve your format.

    Try
    print
    $co->p,$co->checkbox_group(-name=>'onlyd', -Values=>\@matches, -columns=>5
    );

    Tom

    "mike" <rallabs@adelphia.netwrote in message
    @adelphia.com
    >Dear everyone: I find when looking at my post from last night that the
    >problem was not illustrated in the checkbox line: the square checkboxes
    >never showed up! If you wish to help out, please run the script enclosed
    >in the message:
    >>

    >
  • No.5 | | 5724 bytes | |

    Well I think I have a solution for ya.
    I really don't like the control and look of how the CGI.pm
    checkbox_group has. So I usually roll my own checkboxes. I am sure if
    read the CGI.pm stuff there is a way to completely control the way it
    looks. The other problem was how it looks different in different
    browsers which is unfortuanatly always going to be an issue.

    In the solution below I wanted to randomize the test script a little
    more than what you had, based on what you originally posted as your
    question. My solution invloves setting the number of columns you want
    your checkboxes to show up in and then makeing a table with many
    columns and figuring out how many boxes to put in each column.
    This can be good and bad for one it lines things up, organizes them
    and stops the label from wrapping to the next line. on the other hand
    instead of your checkboxes going in this order

    1 2 3 4
    5 6 7

    They will now go in this order

    1 5
    2 6
    3 7
    4

    But if you play with the script a little I'm sure you can some up with
    a way to rearrange them in the original order.

    so here goes

    #!/usr/bin/perl
    use strict;
    use CGI::Carp qw(fatalsToBrowser);
    use CGI qw(:standard -no_xhtml);
    use diagnostics;
    #added warnings
    use warnings;
    #needed later
    use PSIX qw(ceil);

    print header, start_html(-title=>'uneven');

    #I wanted to randomize your strings a little more
    #this is to create an array with 25-50 strings 2-10 in length
    #just an array with some characters
    my @chars = ('a''z','A''Z','0''9');
    my @matches = ();
    # random number of strings from 25-50
    my $num_strings = int(rand 26)+25;
    foreach(1 $num_strings) {
    my $new_str = '';
    my $str_len = int(rand 9)+2; # random string lend from 2-10
    #now create the string
    foreach(1 $str_len) { $new_str .= $chars[rand @chars]; }
    #add it to the array
    push @matches, $new_str;
    }

    #next let's set up a form with all members from the array
    print start_form(-method=>"PST",-action=>"findme.html");
    @matches=sort(@matches);

    #eliminate duplicates in array @matches:
    my %temp=();
    @matches=grep ++$temp{$_}<2, @matches;
    my $lenmatches=@matches;

    #this is the guts of the solution I could come up with
    #I'm not overly fond of the checkbox group method in the CGI
    #so here is how I would do it
    #change the following to the number of columns you want
    my $num_columns=5;
    my $num_in_column=ceil($lenmatches/$num_columns);

    #now I'm going to put the check boxes in a table
    print "<table cellpadding='3' cellspangin='0'>
    <tr nowrap><td valign='top'>\n";
    my $printed=0;
    for(my $i=0; $i<$lenmatches; $i++) {
    if($printed==$num_in_column) {
    print "</td><td valign='top'>";
    $printed=0;
    }

    print
    "<label><input type='checkbox' name='onlyd' value='$matches[$i]' />
    $matches[$i] </label><br>\n";

    $printed++;
    }
    print "</td></tr></table>\n";
    #end guts

    #ok now for show let's do it all like 4 more times
    #and randomize the number of columns for some play
    foreach (1 4) {
    @chars = ('a''z','A''Z','0''9');
    @matches = ();
    $num_strings = int(rand 26)+25;
    foreach(1 $num_strings) {
    my $new_str = '';
    my $str_len = int(rand 9)+2;
    foreach(1 $str_len) {
    $new_str .= $chars[rand @chars];
    }
    push @matches, $new_str;
    }

    print start_form(-method=>"PST",-action=>"findme.html");
    @matches=sort(@matches);
    %temp=();
    @matches=grep ++$temp{$_}<2, @matches;
    $lenmatches=@matches;

    #just going to randmoize the number of columns 1-10
    $num_columns=int(rand 10)+1;
    $num_in_column=ceil($lenmatches/$num_columns);

    print "<hr><table cellpadding='3' cellspangin='0'>
    <tr nowrap><td valign='top'>\n";
    $printed=0;
    for(my $i=0; $i<$lenmatches; $i++) {
    if($printed==$num_in_column) {
    print "</td><td valign='top'>";
    $printed=0;
    }

    print
    "<label><input type='checkbox' name='onlyd' value='$matches[$i]' />
    $matches[$i] </label><br>\n";

    $printed++;
    }
    print "</td></tr></table>\n";
    }

    print p(submit,endform,end_html);

    mike wrote:
    Tom:
    It depends upon the browser! I'm new to this, so I was unaware that this
    was an issue, but running my script with Firefox v1.5.0.2 gives broken
    strings which wrap, but IE gives nice, clean, even lines. Using
    '-columns=>5' didn't work for either browser, ufortunately. I'd rather not
    have to ask the users to employ a particular browser. Does anyone know how
    to tell Firefox to act like Internet Explorer? make Firefox behave?
    Thank you for the help.
    --
    "Tom" <tom@sygration.comwrote in message
    news:%FM5g.983$VV2.74286@news20.bellglobal.com
    Mike,

    I ran your revised script. Even when resizing my screen many times, the
    checkboxes and text remained on the same line.
    You may want to force the number of checkbox rows or columns in your
    checkbox_group function to improve your format.

    Try
    print
    $co->p,$co->checkbox_group(-name=>'onlyd', -Values=>\@matches, -columns=>5
    );
  • No.6 | | 7072 bytes | |

    Christopher:
    Thank you for the solution to my problem. I had been thinking about using
    'mod' on the array length with a denominator equal to the width of the row,
    but I hadn't a good idea of how to implement it. The 'ceil' function did it
    smoothly. Takeaway lesson #1 is I have to learn how to do HTML better now
    that I'm mildly competent in Perl. I've got a book on HTML by E. Castro
    I'm trying to use to get going. My big Perl project is to implement 'state
    saving' in my 30-page script, and my studying of the book 'CGI Programming
    with Perl' from 'Reilly suggests the easiest way to do this is with hidden
    fields, so that's where I'm going. If any expert objects disagrees with
    this, please feel free to let me know.

    I also know now what RTFLL WTIME means. Valuable in itself.

    Thanks to Christopher and to Tom.

    Mike

    "Christopher F. Falzone" <ctiggerf@gmail.comwrote in message
    news:1146666998.218600.75420@
    Well I think I have a solution for ya.
    I really don't like the control and look of how the CGI.pm
    checkbox_group has. So I usually roll my own checkboxes. I am sure if
    read the CGI.pm stuff there is a way to completely control the way it
    looks. The other problem was how it looks different in different
    browsers which is unfortuanatly always going to be an issue.

    In the solution below I wanted to randomize the test script a little
    more than what you had, based on what you originally posted as your
    question. My solution invloves setting the number of columns you want
    your checkboxes to show up in and then makeing a table with many
    columns and figuring out how many boxes to put in each column.
    This can be good and bad for one it lines things up, organizes them
    and stops the label from wrapping to the next line. on the other hand
    instead of your checkboxes going in this order

    1 2 3 4
    5 6 7

    They will now go in this order

    1 5
    2 6
    3 7
    4

    But if you play with the script a little I'm sure you can some up with
    a way to rearrange them in the original order.

    so here goes

    #!/usr/bin/perl
    use strict;
    use CGI::Carp qw(fatalsToBrowser);
    use CGI qw(:standard -no_xhtml);
    use diagnostics;
    #added warnings
    use warnings;
    #needed later
    use PSIX qw(ceil);

    print header, start_html(-title=>'uneven');

    #I wanted to randomize your strings a little more
    #this is to create an array with 25-50 strings 2-10 in length
    #just an array with some characters
    my @chars = ('a''z','A''Z','0''9');
    my @matches = ();
    # random number of strings from 25-50
    my $num_strings = int(rand 26)+25;
    foreach(1 $num_strings) {
    my $new_str = '';
    my $str_len = int(rand 9)+2; # random string lend from 2-10
    #now create the string
    foreach(1 $str_len) { $new_str .= $chars[rand @chars]; }
    #add it to the array
    push @matches, $new_str;
    }

    #next let's set up a form with all members from the array
    print start_form(-method=>"PST",-action=>"findme.html");
    @matches=sort(@matches);

    #eliminate duplicates in array @matches:
    my %temp=();
    @matches=grep ++$temp{$_}<2, @matches;
    my $lenmatches=@matches;

    #this is the guts of the solution I could come up with
    #I'm not overly fond of the checkbox group method in the CGI
    #so here is how I would do it
    #change the following to the number of columns you want
    my $num_columns=5;
    my $num_in_column=ceil($lenmatches/$num_columns);

    #now I'm going to put the check boxes in a table
    print "<table cellpadding='3' cellspangin='0'>
    <tr nowrap><td valign='top'>\n";
    my $printed=0;
    for(my $i=0; $i<$lenmatches; $i++) {
    if($printed==$num_in_column) {
    print "</td><td valign='top'>";
    $printed=0;
    }

    print
    "<label><input type='checkbox' name='onlyd' value='$matches[$i]' />
    $matches[$i] </label><br>\n";

    $printed++;
    }
    print "</td></tr></table>\n";
    #end guts

    #ok now for show let's do it all like 4 more times
    #and randomize the number of columns for some play
    foreach (1 4) {
    @chars = ('a''z','A''Z','0''9');
    @matches = ();
    $num_strings = int(rand 26)+25;
    foreach(1 $num_strings) {
    my $new_str = '';
    my $str_len = int(rand 9)+2;
    foreach(1 $str_len) {
    $new_str .= $chars[rand @chars];
    }
    push @matches, $new_str;
    }

    print start_form(-method=>"PST",-action=>"findme.html");
    @matches=sort(@matches);
    %temp=();
    @matches=grep ++$temp{$_}<2, @matches;
    $lenmatches=@matches;

    #just going to randmoize the number of columns 1-10
    $num_columns=int(rand 10)+1;
    $num_in_column=ceil($lenmatches/$num_columns);

    print "<hr><table cellpadding='3' cellspangin='0'>
    <tr nowrap><td valign='top'>\n";
    $printed=0;
    for(my $i=0; $i<$lenmatches; $i++) {
    if($printed==$num_in_column) {
    print "</td><td valign='top'>";
    $printed=0;
    }

    print
    "<label><input type='checkbox' name='onlyd' value='$matches[$i]' />
    $matches[$i] </label><br>\n";

    $printed++;
    }
    print "</td></tr></table>\n";
    }

    print p(submit,endform,end_html);
    --
    mike wrote:
    >Tom:
    >It depends upon the browser! I'm new to this, so I was unaware that this
    >was an issue, but running my script with Firefox v1.5.0.2 gives broken
    >strings which wrap, but IE gives nice, clean, even lines. Using
    >'-columns=>5' didn't work for either browser, ufortunately. I'd rather
    >not
    >have to ask the users to employ a particular browser. Does anyone know
    >how
    >to tell Firefox to act like Internet Explorer? make Firefox behave?
    >Thank you for the help.
    >>
    >>

    >"Tom" <tom@sygration.comwrote in message
    >news:%FM5g.983$VV2.74286@news20.bellglobal.com
    >Mike,
    >>

    >I ran your revised script. Even when resizing my screen many times,
    >the
    >checkboxes and text remained on the same line.
    >You may want to force the number of checkbox rows or columns in your
    >checkbox_group function to improve your format.
    >>

    >Try
    >print
    >$co->p,$co->checkbox_group(-name=>'onlyd', -Values=>\@matches, -columns=>5
    >);
    >>

    >
    >
  • No.7 | | 8537 bytes | |


    mike wrote:
    Christopher:
    Thank you for the solution to my problem. I had been thinking about using
    'mod' on the array length with a denominator equal to the width of the row,
    but I hadn't a good idea of how to implement it. The 'ceil' function did it
    smoothly.

    Yep, I used the ceil function so that you didn't end up with more
    elements in the last column then the other. I the case that you had 26
    elements and 5 columns just taking 26/5 would round to 5 per leaving 6
    in the last.

    Takeaway lesson #1 is I have to learn how to do HTML better now
    that I'm mildly competent in Perl.

    Well, if that's what your using perl for. <shrug>

    I've got a book on HTML by E. Castro
    I'm trying to use to get going.

    I like the 'Reilly books myself. Just a personal preference.

    My big Perl project is to implement 'state
    saving' in my 30-page script, and my studying of the book 'CGI Programming
    with Perl' from 'Reilly suggests the easiest way to do this is with hidden
    fields, so that's where I'm going.

    State saving really depends on what the script is already doing. If
    you have a really long form you can split it up into several small ones
    and save the state via hidden fields. This does, however, leave your
    script up to some vulnerabilities. someone fills out the form
    once, they can look at the last page's source and see every variable
    you use. This would allow them to create an auto-form submitter fairly
    easy.

    Some other options to think about may be: saving your info to a flat
    file, or database table. , if you want to stick with something more
    html-ish you could also use cookies to save state.

    >If any expert objects disagrees with

    this, please feel free to let me know.

    Not an expert really, and I don't object. If you could give some more
    specifics of the actuall script and what it is doing and what you want
    it to do an what you have tried we can prolly help you out a little
    more.

    I also know now what RTFLL WTIME means. Valuable in itself.

    Yeah I'm a gamer at heart, so I tend to use the more common
    abreviations some times. LL

    Thanks to Christopher and to Tom.

    NP
    YW

    Mike
    --
    "Christopher F. Falzone" <ctiggerf@gmail.comwrote in message
    news:1146666998.218600.75420@
    Well I think I have a solution for ya.
    I really don't like the control and look of how the CGI.pm
    checkbox_group has. So I usually roll my own checkboxes. I am sure if
    read the CGI.pm stuff there is a way to completely control the way it
    looks. The other problem was how it looks different in different
    browsers which is unfortuanatly always going to be an issue.

    In the solution below I wanted to randomize the test script a little
    more than what you had, based on what you originally posted as your
    question. My solution invloves setting the number of columns you want
    your checkboxes to show up in and then makeing a table with many
    columns and figuring out how many boxes to put in each column.
    This can be good and bad for one it lines things up, organizes them
    and stops the label from wrapping to the next line. on the other hand
    instead of your checkboxes going in this order

    1 2 3 4
    5 6 7

    They will now go in this order

    1 5
    2 6
    3 7
    4

    But if you play with the script a little I'm sure you can some up with
    a way to rearrange them in the original order.

    so here goes

    #!/usr/bin/perl
    use strict;
    use CGI::Carp qw(fatalsToBrowser);
    use CGI qw(:standard -no_xhtml);
    use diagnostics;
    #added warnings
    use warnings;
    #needed later
    use PSIX qw(ceil);

    print header, start_html(-title=>'uneven');

    #I wanted to randomize your strings a little more
    #this is to create an array with 25-50 strings 2-10 in length
    #just an array with some characters
    my @chars = ('a''z','A''Z','0''9');
    my @matches = ();
    # random number of strings from 25-50
    my $num_strings = int(rand 26)+25;
    foreach(1 $num_strings) {
    my $new_str = '';
    my $str_len = int(rand 9)+2; # random string lend from 2-10
    #now create the string
    foreach(1 $str_len) { $new_str .= $chars[rand @chars]; }
    #add it to the array
    push @matches, $new_str;
    }

    #next let's set up a form with all members from the array
    print start_form(-method=>"PST",-action=>"findme.html");
    @matches=sort(@matches);

    #eliminate duplicates in array @matches:
    my %temp=();
    @matches=grep ++$temp{$_}<2, @matches;
    my $lenmatches=@matches;

    #this is the guts of the solution I could come up with
    #I'm not overly fond of the checkbox group method in the CGI
    #so here is how I would do it
    #change the following to the number of columns you want
    my $num_columns=5;
    my $num_in_column=ceil($lenmatches/$num_columns);

    #now I'm going to put the check boxes in a table
    print "<table cellpadding='3' cellspangin='0'>
    <tr nowrap><td valign='top'>\n";
    my $printed=0;
    for(my $i=0; $i<$lenmatches; $i++) {
    if($printed==$num_in_column) {
    print "</td><td valign='top'>";
    $printed=0;
    }

    print
    "<label><input type='checkbox' name='onlyd' value='$matches[$i]' />
    $matches[$i] </label><br>\n";

    $printed++;
    }
    print "</td></tr></table>\n";
    #end guts

    #ok now for show let's do it all like 4 more times
    #and randomize the number of columns for some play
    foreach (1 4) {
    @chars = ('a''z','A''Z','0''9');
    @matches = ();
    $num_strings = int(rand 26)+25;
    foreach(1 $num_strings) {
    my $new_str = '';
    my $str_len = int(rand 9)+2;
    foreach(1 $str_len) {
    $new_str .= $chars[rand @chars];
    }
    push @matches, $new_str;
    }

    print start_form(-method=>"PST",-action=>"findme.html");
    @matches=sort(@matches);
    %temp=();
    @matches=grep ++$temp{$_}<2, @matches;
    $lenmatches=@matches;

    #just going to randmoize the number of columns 1-10
    $num_columns=int(rand 10)+1;
    $num_in_column=ceil($lenmatches/$num_columns);

    print "<hr><table cellpadding='3' cellspangin='0'>
    <tr nowrap><td valign='top'>\n";
    $printed=0;
    for(my $i=0; $i<$lenmatches; $i++) {
    if($printed==$num_in_column) {
    print "</td><td valign='top'>";
    $printed=0;
    }

    print
    "<label><input type='checkbox' name='onlyd' value='$matches[$i]' />
    $matches[$i] </label><br>\n";

    $printed++;
    }
    print "</td></tr></table>\n";
    }

    print p(submit,endform,end_html);
    --
    mike wrote:
    >Tom:
    >It depends upon the browser! I'm new to this, so I was unaware that this
    >was an issue, but running my script with Firefox v1.5.0.2 gives broken
    >strings which wrap, but IE gives nice, clean, even lines. Using
    >'-columns=>5' didn't work for either browser, ufortunately. I'd rather
    >not
    >have to ask the users to employ a particular browser. Does anyone know
    >how
    >to tell Firefox to act like Internet Explorer? make Firefox behave?
    >Thank you for the help.
    >>
    >>

    >"Tom" <tom@sygration.comwrote in message
    >news:%FM5g.983$VV2.74286@news20.bellglobal.com
    >Mike,
    >>

    >I ran your revised script. Even when resizing my screen many times,
    >the
    >checkboxes and text remained on the same line.
    >You may want to force the number of checkbox rows or columns in your
    >checkbox_group function to improve your format.
    >>

    >Try
    >print
    >$co->p,$co->checkbox_group(-name=>'onlyd', -Values=>\@matches, -columns=>5
    >);
    >>

    >
    >

Re: even rows for checkbox forms with no splitting of boxes from values


max 4000 letters.
Your nickname that display:
In order to stop the spam: 6 + 6 =
QUESTION ON "WWW"

EMSDN.COM