Esempio n. 1
0
 function test()
 {
     $textarea = new FormKit\Widget\TextareaInput('address');
     $html = $textarea->render(array('rows' => 30, 'cols' => 45));
     $dom = new DOMDocument();
     $dom->loadXml($html);
     is('formkit-widget formkit-widget-textarea', $dom->documentElement->getAttribute('class'));
     is('address', $dom->documentElement->getAttribute('name'));
     is('45', $dom->documentElement->getAttribute('cols'));
     is('30', $dom->documentElement->getAttribute('rows'));
 }
Esempio n. 2
0
        FormKit.initialize(document.body);
    });
    </script>

</head>
<body>
<?php 
$layout = new FormKit\Layout\GenericLayout();
$layout->width(400);
/**
 * Initialize form widgets for demo
 */
$text = new FormKit\Widget\TextInput('username', array('label' => 'Username', 'hint' => 'Please enter 6 characters for your username'));
$text->value('default')->maxlength(10)->minlength(3)->size(20);
$layout->addWidget($text);
$textarea = new FormKit\Widget\TextareaInput('description', array('label' => _('Description')));
$textarea->value('說明文字')->cols(50)->rows(5);
$password = new FormKit\Widget\PasswordInput('password', array('label' => 'Password'));
$layout->addWidget($password);
$remember = new FormKit\Widget\CheckboxInput('remember', array('label' => 'Remember me'));
$remember->value(12);
$remember->check();
$layout->addWidget($remember);
$imageInput = new FormKit\Widget\ImageFileInput('image', array('label' => 'Image', 'value' => 'new-google-chrome-logo.jpg'));
$dateSelect = new FormKit\Widget\DateSelectInput('my_date', array('label' => _('DateSelectInput'), 'format' => 'Y/m/d g:h:i', 'start_year' => '2000', 'end_year' => '2012', 'value' => '2010/09/03'));
$layout->addWidget($dateSelect);
$dateSelect = new FormKit\Widget\DateSelectInput('my_date2', array('label' => _('DateSelectInput'), 'format' => 'YMj, G:H:i', 'data_format' => 'Y-m-d G:H:i', 'start_year' => '2000', 'end_year' => '2012', 'value' => new DateTime()));
$layout->addWidget($dateSelect);
$yearSelect = new FormKit\Widget\YearSelectInput('year', array('label' => _('YearSelectInput'), 'start_year' => 2000, 'end_year' => 2012, 'value' => 2011));
$layout->addWidget($yearSelect);
$birthday = new FormKit\Widget\DateInput('birthday', array('label' => 'Birthday', 'format' => 'Y.n.j', 'value' => new DateTime('now', new DateTimeZone('Asia/Taipei'))));