Exemplo n.º 1
0
  <body>
    <div>
      <?php 
foreach ($examples as $key => $file) {
    echo '<a href="?example=', $key, '">', $key, '</a>, ';
}
?>
    </div>
    <div>
      <form method="POST" action="?example=<?php 
echo $example;
?>
" >
        <?php 
if ($example) {
    $inputSource = new ymcHtmlFormInputSourceFilterExtension(INPUT_POST);
    $form = getForm();
    $form->init();
    if ($inputSource->hasData()) {
        $form->validate($inputSource);
    }
    echo getBody($example, $form);
}
?>
        <input type="submit" value="submit" />
      </form>
    </div>
    <div>
      <h1>$_POST</h1>
      <?php 
var_dump($_POST);
Exemplo n.º 2
0
require_once 'ezc/Base/ezc_bootstrap.php';
ezcBase::addClassRepository('../../src');
// BEGINFORMINIT
class SimpleGreetingForm extends ymcHtmlFormGeneric
{
    public function __construct()
    {
        parent::__construct();
        $this->group->add(new ymcHtmlFormElementText('forename'));
        $this->group->add(new ymcHtmlFormElementText('surname'));
        $this->init();
    }
}
$form = new SimpleGreetingForm();
// ENDFORMINIT
$input = new ymcHtmlFormInputSourceFilterExtension();
if ($input->hasData()) {
    $form->validate($input);
}
?>
 

<html>
  <head>
    <style>
      form .failed{
        border:1px solid red;
      }
    </style>
  </head>
  <body>