Beispiel #1
0
require 'form_secure_submit.php';
$key = "my secret key";
$form = new form_class();
$form->ID = 'secure_form';
$form->METHOD = 'POST';
$form->ACTION = '?';
$form->debug = 'trigger_error';
$error = $form->AddInput(array('TYPE' => 'custom', 'VALUE' => 'Secure submit', 'ID' => 'secure_submit', 'NAME' => 'secure_submit', 'CustomClass' => 'form_secure_submit_class', 'Key' => $key));
if (strlen($error)) {
    die("Error: " . $error);
}
$submitted = $form->WasSubmitted('secure_submit');
$form->LoadInputValues($submitted);
$verify = array();
if ($submitted) {
    if (strlen($error_message = $form->Validate($verify)) == 0) {
        $doit = 1;
    } else {
        $doit = 0;
        $error_message = HtmlEntities($error_message);
    }
} else {
    $error_message = '';
    $doit = 0;
}
if (!$doit) {
    $focus = 'secure_submit';
    $form->ConnectFormToInput($focus, 'ONLOAD', 'Focus', array());
}
$onload = HtmlSpecialChars($form->PageLoad());
?>
 */
require 'forms.php';
$form = new form_class();
$form->NAME = 'dependent_validation_form';
$form->METHOD = 'POST';
$form->ACTION = '';
$form->InvalidCLASS = 'invalid';
$form->ShowAllErrors = 0;
$form->debug = 'trigger_error';
$form->AddInput(array('TYPE' => 'checkbox', 'ID' => 'condition', 'NAME' => 'condition', 'CHECKED' => 1, 'LABEL' => '<u>V</u>alidate', 'ACCESSKEY' => 'V'));
$form->AddInput(array('TYPE' => 'text', 'ID' => 'dependent', 'NAME' => 'dependent', 'LABEL' => '<u>D</u>ependent', 'ACCESSKEY' => 'D', 'ValidateAsNotEmpty' => 1, 'ValidationErrorMessage' => 'It was not entered a value in the dependent field.', 'DependentValidation' => 'condition'));
$form->AddInput(array('TYPE' => 'submit', 'VALUE' => 'Submit', 'NAME' => 'doit'));
$form->LoadInputValues($form->WasSubmitted('doit'));
$verify = array();
if ($form->WasSubmitted('doit')) {
    if (($error_message = $form->Validate($verify)) == '') {
        $doit = 1;
    } else {
        $doit = 0;
        $error_message = HtmlEntities($error_message);
    }
} else {
    $error_message = '';
    $doit = 0;
}
if (!$doit) {
    $form->ConnectFormToInput('dependent', 'ONLOAD', 'Focus', array());
}
$onload = HtmlSpecialChars($form->PageLoad());
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
         die('Error: ' . $view->error);
     }
     $form->SetInputProperty('posts', 'IDColumn', $id_column);
     $form->SetInputProperty('posts', 'Columns', $columns);
     $form->SetInputProperty('posts', 'TotalEntries', $total_posts);
     $form->SetInputProperty('posts', 'PageEntries', $page_entries);
     $form->SetInputProperty('posts', 'Page', $page);
     $form->SetInputProperty('posts', 'Rows', $posts);
     break;
 case "created":
     /*
      *  When the created event is sent, applications should
      *  validate the form and create a new entry if it is all
      *  OK.
      */
     if (strlen($error_message = $form->Validate($verify, 'posts-submit')) == 0) {
         $form->LoadInputValues(1);
         $entry = array('title' => $form->GetInputValue('title'), 'body' => $form->GetInputValue('body'));
         if (!$model->CreateEntry($entry)) {
             /*
              *  If there was a problem creating an entry, cancel the
              *  entry creation and display an helpful error message.
              */
             $message['Cancel'] = 1;
             $form->SetInputProperty('posts', 'CreateCanceledMessage', 'Error: ' . $model->error);
         } else {
             /*
              *  If the entry was created successfully, set the Entry
              *  entry of the message array to pass back the
              *  identifier of the newly created entry.
              */