コード例 #1
0
ファイル: form_generic.php プロジェクト: jou/ymc-components
 /**
  * @expectedException ymcHtmlFormDuplicateNameException
  */
 public function testDuplicateNameThrowsException()
 {
     $group1 = new ymcHtmlFormElementsGroupGeneric('group1');
     $group1->add(new ymcHtmlFormElementText('same'));
     $group2 = new ymcHtmlFormElementsGroupGeneric('group2');
     $group2->add(new ymcHtmlFormElementText('same'));
     $form = new ymcHtmlFormGeneric();
     $form->group->add($group1);
     $form->group->add($group2);
     $form->init();
     $this->fail('Expected exception');
 }
コード例 #2
0
ファイル: redisplay.php プロジェクト: jou/ymc-components
 public function __construct()
 {
     parent::__construct();
     $this->group->add(new ymcHtmlFormElementText('forename'));
     $this->group->add(new ymcHtmlFormElementText('surname'));
     $this->init();
 }
コード例 #3
0
ファイル: simple.php プロジェクト: jou/ymc-components
<?php

// build and initialize the form
require_once 'ezc/Base/ezc_bootstrap.php';
ezcBase::addClassRepository('../../src');
$form = new ymcHtmlFormGeneric();
$form->group->add(new ymcHtmlFormElementText('surname'));
$form->group->add(new ymcHtmlFormElementText('forename'));
$form->init();
$input = new ymcHtmlFormInputSourceFilterExtension();
if ($input->hasData()) {
    $form->validate($input);
}
?>

<html><body>

  <form method="POST">
  
    <label for="form-element-forename">forename:</label>
    <input id="form-element-forename" type="text" name="forename" />
    <label for="form-element-surname">surname:</label>
    <input id="form-element-surname" type="text" name="surname" />
  
    <input type="submit" />
  
  </form>

<?php 
// Process the values only, if the form is valid
if ($input->hasData() && $form->isValid()) {