phpObjectForms Library SourceForge Logo

<?php
include "../../include/shared.inc.php";
$page = new Page(array(
    
"title" => 'FPSplitSelect Sample',
    
"stylesheets" => array( 'pof/blue' )
));
$page->commonHeader();
?>
<br>
<?php

// Initialize
require "../lib/FormProcessor.class.php";
$fp = new FormProcessor("../lib/");
$fp->importElements(array("FPButton""extra/FPSplitSelect"));
$fp->importLayouts(array("FPColLayout""FPRowLayout"));


// Create the form object
$myForm = new FPForm(array(
    
"title" => 'FPSplitSelect Sample Form',
    
"name" => 'myForm',
    
"action" => $_SERVER["PHP_SELF"],
    
"display_outer_table" => true,
    
"table_align" => 'center',
));

$myForm->setBaseLayout(
    new 
FPColLayout(array(
        
"table_padding" => 5,
        
"element_align" => "center",
        
"elements" => array(
            new 
FPSplitSelect(array(
                
"name" => "fruits",
                
//"title" => "Fruits",
                
"size" => 4,
                
"options" => array(
                    
=> "Apple",
                    
=> "Banana",
                    
=> "Birne",
                    
=> "Mango",
                    
=> "Orange",
                    
=> "Peach",
                    
=> "Pineapple",
                ),
                
"left_title" => "Fruits",
                
"right_title" => "Your chose:",
                
"right_ids" => array(),
                
"css_style" => "width:120px;",
                
"table_padding" => 5,
            )),

            new 
FPRowLayout(array(
            
"table_align" => "center",
            
"table_padding" => 20,
            
"elements" => array(
                new 
FPButton(
                array(
                    
"submit" => true,
                    
"name" => 'submit',
                    
"title" => '    OK   ',
                )),
            )
            )),

        )
    ))
);

// Obtain submitted data and check the values correctness
if ($myForm->getSubmittedData()  &&  $myForm->isDataValid()) {

        
$elements $myForm->getElementValues();
        echo
        
'<div align="left">'.
            
'Thank you, your data is valid!'.
            
'<pre>'
        
;
                
var_dump($elements);
        echo
            
'</pre>'.
        
'</div>';
} else
    
$myForm->display();

?>

<?php
$page
->commonFooter();
?>

 © Copyright 2002-2004, Ilya Boyandin <ilyabo at gmail com>

 Hosted by sourceforge.net