newhck / php-form-builder-class

Automatically exported from code.google.com/p/php-form-builder-class
GNU General Public License v3.0
0 stars 0 forks source link

labelWidth + labelAlignRight != label + element side by side #81

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create a new form, set attributes with only include path (or with width, 
labelWidth, labelAlignRight) set.  
2.  add width, labelWidth, labelAlignRight to the element in addSelect function 
call
3.  render form

What is the expected output? What do you see instead?

Expect to see my label to the right of my select dropdown. My select box is 
ALWAYS on a new line because, it seems, the pfbc-label style says display: 
block.  no matter what i do?

What version of the product are you using? On what operating system?

1.1.2 os x snow leopard and firefox browser

Please provide any additional information below.

Code:  

$form = new form('sample_reg_1');

$form->setAttributes(array(
    "includesPath" => "api/php-form-builder/includes",
    "width" => 600,
    "labelRightAlign" => 1,
    "labelWidth" => "100"
    )); 

$form->addSelect(
                 'Select Type of Object*:', // label 
                 'sample_type_id', // element name 
                 (isset($_POST['sample_type_id']) ? $_POST['sample_type_id'] : ''), // value
                 $sample_types, // options
                 array('required' => 1,       // additionalParams
                       "style" => "width: 200px",
                       "labelRightAlign" => 1,
                       "labelWidth" => "100"));

print_r output of element:

element Object
(
    [alphanumeric] => 
    [attributes] => Array
        (
            [type] => select
            [name] => sample_type_id
            [value] => 
            [style] => width: 200px
        )

    [basic] => 
    [container] => #pfbc-sample_reg_1-element-0
    [height] => 
    [hideCancel] => 
    [hideCaption] => 
    [hideDisplay] => 
    [hideJump] => 
    [ignoreGSSend] => 
    [integer] => 
    [jqueryOptions] => 
    [label] => Select Type of Object*:
    [labelPaddingRight] => 
    [labelRightAlign] => 1
    [labelWidth] => 100
    [max] => 
    [min] => 
    [months] => 
    [noBreak] => 
    [options] => Array
        (
            [0] => option Object
                (
                    [text] => Core
                    [value] => 4
                )

            [1] => option Object
                (
                    [text] => Core half round
                    [value] => 8
                )

            [2] => option Object
                (
                    [text] => Core piece
                    [value] => 10
                )

            [3] => option Object
                (
                    [text] => Core quarter round
                    [value] => 9
                )

            [4] => option Object
                (
                    [text] => Core section
                    [value] => 5
                )

            [5] => option Object
                (
                    [text] => Core section half
                    [value] => 6
                )

            [6] => option Object
                (
                    [text] => Core sub-piece
                    [value] => 11
                )

            [7] => option Object
                (
                    [text] => Core whole round
                    [value] => 7
                )

            [8] => option Object
                (
                    [text] => Cuttings
                    [value] => 3
                )

            [9] => option Object
                (
                    [text] => Dredge
                    [value] => 12
                )

            [10] => option Object
                (
                    [text] => Grab
                    [value] => 1
                )

            [11] => option Object
                (
                    [text] => Hole
                    [value] => 2
                )

            [12] => option Object
                (
                    [text] => Individual Sample
                    [value] => 15
                )

            [13] => option Object
                (
                    [text] => Oriented Core
                    [value] => 17
                )

            [14] => option Object
                (
                    [text] => Other
                    [value] => 14
                )

            [15] => option Object
                (
                    [text] => Terrestrial Section
                    [value] => 13
                )

            [16] => option Object
                (
                    [text] => Trawl
                    [value] => 16
                )

            [17] => option Object
                (
                    [text] => rock powder
                    [value] => 35
                )

        )

    [orientation] => 
    [prefix] => 
    [preHTML] => 
    [postHTML] => 
    [required] => 1
    [snapIncrement] => 
    [suffix] => 
    [tooltip] => 
    [tooltipID] => 
    [width] => 
    [zoom] => 
)

Original issue reported on code.google.com by rj05cole...@gmail.com on 19 Oct 2010 at 7:35

Attachments:

GoogleCodeExporter commented 8 years ago
The labelRightAlign attribute doesn't display the label to the right of the 
appropriate form element.  Instead, it just right aligns the text inside the 
label.  To display the label to the right of the appropriate form element, you 
will have to use the preventDefaultCSS form attribute and apply your own css 
definitions.

$form->setAttributes(array(
"preventDefaultCSS" => 1
));

- Andrew

Original comment by ajporterfield@gmail.com on 20 Oct 2010 at 8:47

GoogleCodeExporter commented 8 years ago
The latest svn revision - r417 - includes a new form/element attribute, 
labelDisplayRight, that can be used display labels to the right of their 
appropriate form element.  The layout.php has been updated in this revision as 
well to demo the new functionality.

This update will be included in the 1.1.3 version release.

- Andrew

Original comment by ajporterfield@gmail.com on 21 Oct 2010 at 3:11