Ejemplo n.º 1
0
<?php

/*
 * test_secure_submit.php
 *
 * @(#) $Header: /home/mlemos/cvsroot/forms/test_secure_submit.php,v 1.2 2007/05/09 01:43:29 mlemos Exp $
 *
 */
require 'forms.php';
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 {
Ejemplo n.º 2
0
 * elements in each page.
 */
require "form_layout_vertical.php";
/*
 * Include form paged layout plug-in class to layout the form pages
 */
require "form_layout_paged.php";
/*
 * Include form animation plug-in class if you want to use the fade effect
 * when the pages are switched
 */
require "form_animation.php";
/*
 * Create a form object.
 */
$form = new form_class();
/*
 * Define the name of the form to be used for example in Javascript
 * validation code generated by the class.
 */
$form->NAME = "subscription_form";
/*
 * Use the GET method if you want to see the submitted values in the form
 * processing URL, or POST otherwise.
 */
$form->METHOD = "POST";
/*
 * Make the form be displayed and also processed by this script.
 */
$form->ACTION = "";
/*
Ejemplo n.º 3
0
<?php

/*
 * test_list_select.php
 *
 * @(#) $Header: /home/mlemos/cvsroot/forms/test_list_select.php,v 1.1 2009/11/11 08:19:27 mlemos Exp $
 *
 */
require "forms.php";
require "form_list_select.php";
$currencies = array('' => 'None', 'USD' => 'USD', 'EUR' => 'EUR', 'GPB' => 'GBP', 'YEN' => 'YEN');
$form = new form_class();
$form->NAME = "currency_form";
$form->METHOD = "POST";
$form->ACTION = "";
$form->debug = "error_log";
$form->AddInput(array("TYPE" => "custom", "ID" => "currency", "NAME" => "currency", "LABEL" => "<u>C</u>urrency", "ACCESSKEY" => "t", "CustomClass" => "form_list_select_class", "VALUE" => "", "OPTIONS" => $currencies, 'Columns' => array(array('Type' => 'Input'), array('Type' => 'Option', 'Header' => 'Symbol'), array('Type' => 'Data', 'Header' => 'Name', 'Row' => 'Name'), array('Type' => 'Data', 'Header' => 'Region', 'Row' => 'Region'), array('Type' => 'Data', 'Header' => 'Value', 'Row' => 'Value')), 'Rows' => array('USD' => array('Name' => 'Dollar', 'Region' => 'United States', 'Value' => '<tt>$1.00</tt>'), 'EUR' => array('Name' => 'Euro', 'Region' => 'Europe', 'Value' => '<tt>$1.4986</tt>'), 'GPB' => array('Name' => 'Pound', 'Region' => 'United Kingdom', 'Value' => '<tt>$1.6737</tt>'), 'YEN' => array('Name' => 'Yen', 'Region' => 'Japan', 'Value' => '<tt>$0.011132</tt>'))));
$form->AddInput(array("TYPE" => "submit", "VALUE" => "Choose", "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;
}
Ejemplo n.º 4
0
<?php

/*
 *
 * @(#) $Id: test_captcha_input.php,v 1.9 2006/12/20 06:21:16 mlemos Exp $
 *
 */
require "forms.php";
require "form_captcha.php";
$key = "my secret key";
$form = new form_class();
$form->NAME = "captcha_form";
$form->METHOD = "POST";
$form->ACTION = "";
$form->debug = "error_log";
$error = $form->AddInput(array("TYPE" => "custom", "ID" => "captcha", "LABEL" => "<u>E</u>nter the following text:", "ACCESSKEY" => "E", "CustomClass" => "form_captcha_class", "Key" => $key, "ImageFormat" => "png", "NoiseFromPNGImage" => "noise.png", "ResetIncorrectText" => 1, "BackgroundColor" => "#FFFFFF", "ValidationErrorMessage" => "It was not entered the correct text.", "ExpiryTime" => 60, "ExpiryTimeValidationErrorMessage" => "The validation text has expired."));
if (strlen($error)) {
    die("Error: " . $error);
}
$form->AddInput(array("TYPE" => "submit", "VALUE" => "Submit", "NAME" => "doit"));
/*
 * This code is necessary to handle the requests for serving the captcha
 * image.
 * Do not remove it nor output any data or headers before these lines.
 */
$form->HandleEvent($processed);
if ($processed) {
    exit;
}
$form->LoadInputValues($form->WasSubmitted("doit"));
$verify = array();
Ejemplo n.º 5
0
/*
 *
 * @(#) $Id: test_map_location_input.php,v 1.6 2009/10/24 04:48:44 mlemos Exp $
 *
 */
require "forms.php";
require "form_map_location.php";
require "country_codes.php";
/*
 * Request a Google Maps key for your domain here:
 * http://www.google.com/apis/maps/signup.html
 */
$key = "ABQIAAAA7V8XnKRU9Ap_TYRAFk9tqRSjKdwWpQikcbMmFM-d61BWa0XlKhRfShNejYLw0m_FSORW6mu6r-IHlg";
$adsense_publisher = 'ca-pub-2951707118576741';
$adsense_channel = '0637651970';
$form = new form_class();
$form->NAME = "maps_form";
$form->METHOD = "POST";
$form->ACTION = "";
$form->debug = "trigger_error";
/*
 * This is just for testing purposes
 */
if (defined('GOOGLE_MAPS_KEY')) {
    $key = GOOGLE_MAPS_KEY;
}
if (defined('ADSENSE_PUBLISHER')) {
    $adsense_publisher = ADSENSE_PUBLISHER;
}
if (defined('ADSENSE_CHANNEL')) {
    $adsense_publisher = ADSENSE_CHANNEL;
Ejemplo n.º 6
0
<?php

/*
 * test_encoded_pasword.php
 *
 * @(#) $Header: /home/mlemos/cvsroot/forms/test_encoded_password.php,v 1.6 2006/12/20 06:21:16 mlemos Exp $
 *
 */
require "forms.php";
$form = new form_class();
$form->NAME = "login_form";
$form->METHOD = "GET";
$form->ACTION = "";
$form->debug = "trigger_error";
$form->AddInput(array("TYPE" => "text", "NAME" => "access_name", "MAXLENGTH" => 20, "Capitalization" => "uppercase", "ValidateRegularExpression" => "^[a-zA-Z0-9\\-_]+\$", "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "It was not specified a valid access name"));
$form->AddInput(array("TYPE" => "hidden", "NAME" => "user_login", "ID" => "user_login", "VALUE" => ""));
$form->AddInput(array("TYPE" => "password", "NAME" => "password", "ONCHANGE" => "if(value.toLowerCase) value=value.toLowerCase()", "Encoding" => "MD5", "EncodingFunctionVerification" => "loaded_MD5", "EncodedField" => "user_login", "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "It was not specified a valid password"));
$form->AddInput(array("TYPE" => "submit", "VALUE" => "Login", "NAME" => "doit"));
$form->LoadInputValues($form->WasSubmitted("doit"));
$verify = array();
if ($form->WasSubmitted("doit")) {
    $user_login = $form->GetInputValue("user_login");
    if (strcmp($user_login, "")) {
        $password = $user_login;
        $user_login = "";
        $form->SetInputValue("user_login", $user_login);
    } else {
        $password = $form->GetInputValue("password");
        if (strcmp($password, "")) {
            $password = md5(strtolower($password));
        }
Ejemplo n.º 7
0
<?php

/*
 * test_upload_progress.php
 *
 * @(#) $Header: /home/mlemos/cvsroot/forms/test_upload_progress.php,v 1.7 2008/08/16 05:12:37 mlemos Exp $
 *
 */
require 'forms.php';
require 'form_ajax_submit.php';
require 'form_upload_progress.php';
$form = new form_class();
$form->NAME = 'upload_form';
$form->METHOD = 'POST';
$form->ACTION = '';
$form->ENCTYPE = 'multipart/form-data';
$form->debug = 'error_log';
$form->ResubmitConfirmMessage = 'Are you sure you want to submit this form again?';
$form->AddInput(array('TYPE' => 'file', 'NAME' => 'userfile', 'ValidateAsNotEmpty' => 1, 'ValidationErrorMessage' => 'It was not specified a valid file to upload'));
$form->AddInput(array('TYPE' => 'submit', 'VALUE' => 'Upload', 'NAME' => 'doit'));
$form->AddInput(array('TYPE' => 'hidden', 'NAME' => 'MAX_FILE_SIZE', 'VALUE' => 1000000));
$form->AddInput(array('TYPE' => 'custom', 'NAME' => 'upload_progress', 'ID' => 'upload_progress', 'FeedbackElement' => 'feedback', 'FeedbackFormat' => '<center>
<table style="width: 200px" class="progress_container" border="1">
<tr><td style="width: {ACCURATE_PROGRESS}%;" class="progress_bar">
<tt>{PROGRESS}%</tt></td><td style="border-style: none;"></td>
</tr></table><br />
<tt>Uploaded {UPLOADED}B of {TOTAL}B<br />
Remaining time: {REMAINING}<br />
Average speed: {AVERAGE_SPEED}B/s<br />
Current speed: {CURRENT_SPEED}B/s</tt></center>', 'CustomClass' => 'form_upload_progress_class'));
/*
Ejemplo n.º 8
0
<?php

/*
 * This example serves to demonstrate how to develop a custom input that
 * implements a new type of validation not supported by the main forms class.
 * 
 * @(#) $Id: $
 *
 */
require 'forms.php';
require 'form_custom_validation.php';
$form = new form_class();
$form->NAME = 'custom_validation_form';
$form->METHOD = 'POST';
$form->ACTION = '';
$form->InvalidCLASS = 'invalid';
$form->ShowAllErrors = 0;
$form->debug = 'trigger_error';
$form->AddInput(array('TYPE' => 'text', 'ID' => 'first', 'NAME' => 'first', 'LABEL' => '<u>F</u>irst name', 'ACCESSKEY' => 'F', 'ValidateAsNotEmpty' => 1, 'ValidationErrorMessage' => 'It was not specified a valid first name.'));
$form->AddInput(array('TYPE' => 'text', 'ID' => 'second', 'NAME' => 'second', 'LABEL' => '<u>S</u>econd name', 'ACCESSKEY' => 'S', 'ValidateAsNotEmpty' => 1, 'ValidationErrorMessage' => 'It was not specified a valid second name.'));
/*
 *  Add a custom input that will be used only for validation purposes
 */
$error = $form->AddInput(array('TYPE' => 'custom', 'ID' => 'validation', 'CustomClass' => 'form_custom_validation_class', 'FirstInput' => 'first', 'FirstValidationErrorMessage' => 'The first name is contained in the second name.', 'SecondInput' => 'second', 'SecondValidationErrorMessage' => 'The second name is contained in the first name.'));
/*
 *  If something went wrong, probably due to missing or invalid parameters,
 *  it is safer to exit the script so the rest of the script does not execute
 */
if (strlen($error)) {
    die('Error: ' . $error);
}
Ejemplo n.º 9
0
<?php

/*
 *
 * @(#) $Id: test_date_input.php,v 1.9 2009/05/26 04:39:08 mlemos Exp $
 *
 */
require "forms.php";
require "form_date.php";
$day_seconds = 60 * 60 * 24;
$start_date = strftime("%Y-%m-%d", time() + 1 * $day_seconds);
$end_date = strftime("%Y-%m-%d", time() + 7 * $day_seconds);
$today = 'now';
$form = new form_class();
$form->NAME = "date_form";
$form->METHOD = "POST";
$form->ACTION = "";
$form->debug = "trigger_error";
$form->InvalidCLASS = 'invalid';
$form->ShowAllErrors = 1;
/*
 * The following lines are for testing purposes.
 * Remove these lines when adapting this example to real applications.
 */
if (defined("__TEST")) {
    if (isset($__test_options["ShowAllErrors"])) {
        $form->ShowAllErrors = $__test_options["ShowAllErrors"];
    }
    if (isset($__test_options["today"])) {
        $today = $__test_options["today"];
    }
Ejemplo n.º 10
0
 *
 */
require 'Smarty.class.php';
/*
 * Include Smarty template prefilter plugin function
 *
 */
require "plugins/prefilter.form.php";
/*
 * Include form class code.
 */
require "forms.php";
/*
 * Create a form object.
 */
$form = new form_class();
/*
 * Define the name of the form to be used for example in Javascript validation
 * code generated by the class.
 */
$form->NAME = "subscription_form";
/*
 * Use the GET method if you want to see the submitted values in the form
 * processing URL, or POST otherwise.
 */
$form->METHOD = "GET";
/*
 * Make the form be displayed and also processed by this script.
 */
$form->ACTION = "";
/*
<?php

/*
 * test_javascript_string_escaping.php
 *
 * @(#) $Id: test_javascript_string_escaping.php,v 1.1 2008/02/04 05:58:20 mlemos Exp $
 *
 */
require 'forms.php';
$form = new form_class();
$strings = array('', "\n", "\r", "\t", '<', '%', '\'', '\\', chr(160), "\n<", "<%", "<'", "<\\", "<\n", "<\r", "<\t", ' <');
$t = count($strings);
for ($s = 0; $s < $t; ++$s) {
    echo $form->EncodeJavascriptString($strings[$s]), "\n";
}
Ejemplo n.º 12
0
<?php

/*
 *
 * @(#) $Id: test_age_date_input.php,v 1.2 2009/05/26 04:39:08 mlemos Exp $
 *
 */
require "forms.php";
require "form_date.php";
$today = 'now';
$start_date = '1995-01-01';
$end_date = $today;
$form = new form_class();
$form->NAME = "experience_form";
$form->METHOD = "GET";
$form->ACTION = "";
$form->debug = "trigger_error";
$form->InvalidCLASS = 'invalid';
$form->ShowAllErrors = 1;
/*
 * The following lines are for testing purposes.
 * Remove these lines when adapting this example to real applications.
 */
if (defined("__TEST")) {
    if (isset($__test_options["ShowAllErrors"])) {
        $form->ShowAllErrors = $__test_options["ShowAllErrors"];
    }
    if (isset($__test_options["today"])) {
        $today = $__test_options["today"];
    }
    if (isset($__test_options["start_date"])) {
Ejemplo n.º 13
0
<?php

/*
 * test_auto_complete.php
 *
 * @(#) $Header: /home/mlemos/cvsroot/forms/test_auto_complete.php,v 1.9 2006/12/20 06:21:16 mlemos Exp $
 *
 */
require 'forms.php';
require 'form_ajax_submit.php';
require 'form_auto_complete.php';
$form = new form_class();
$form->NAME = 'auto_complete_form';
$form->METHOD = 'POST';
$form->ACTION = '';
$form->debug = 'error_log';
$form->AddInput(array('TYPE' => 'text', 'ID' => 'color', 'NAME' => 'color', 'LABEL' => '<u>C</u>olor', 'ACCESSKEY' => 'C', 'VALUE' => '', 'SIZE' => 32, 'ExtraAttributes' => array('autocomplete' => 'off')));
$form->AddInput(array('TYPE' => 'button', 'NAME' => 'show_colors', 'ID' => 'show_colors', 'VALUE' => '...'));
$form->AddInput(array('TYPE' => 'custom', 'ID' => 'complete_color', 'NAME' => 'complete_color', 'CustomClass' => 'form_auto_complete_class', 'CompleteInput' => 'color', 'CompleteMinimumLength' => 1, 'CompleteValues' => array('Black' => '
				<span style="background-color: black; color: white;">B</span>lack', 'Blue' => '<span style="background-color: blue; color: white;">B</span>lue', 'Cyan' => '<span style="background-color: cyan;  color: #000000">C</span>yan', 'Green' => '<span style="background-color: green; color: white;">G</span>reen', 'Magenta' => '<span style="background-color: magenta">M</span>agenta', 'Red' => '<span style="background-color: red">R</span>ed', 'White' => '<span style="background-color: white; color: #000000">W</span>hite', 'Yellow' => '<span style="background-color: yellow; color: #000000">Y</span>ellow'), 'Dynamic' => 1, 'ShowButton' => 'show_colors', 'FeedbackElement' => 'complete_color_feedback', 'SubmitFeedback' => '
			<img src="indicator.gif" width="16" height="16" alt="Looking up for colors" title="Looking up for colors" /> ', 'CompleteFeedback' => '
			<img src="indicator.gif" width="16" height="16" style="visibility: hidden;" /> '));
$form->AddInput(array('TYPE' => 'text', 'ID' => 'font', 'NAME' => 'font', 'LABEL' => '<u>F</u>ont', 'ACCESSKEY' => 'F', 'VALUE' => '', 'SIZE' => 32, 'ExtraAttributes' => array('autocomplete' => 'off')));
$form->AddInput(array('TYPE' => 'image', 'NAME' => 'show_fonts', 'ID' => 'show_fonts', 'SRC' => 'pulldown.gif', 'ALT' => 'Show fonts', 'ALIGN' => 'top'));
$form->AddInput(array('TYPE' => 'custom', 'ID' => 'complete_font', 'NAME' => 'complete_font', 'CustomClass' => 'form_auto_complete_class', 'CompleteInput' => 'font', 'CompleteMinimumLength' => 1, 'CompleteValues' => array('sans-serif' => '<span style="font-family: sans-serif; float: right">ABC</span>Sans Serif', 'serif' => '<span style="font-family: serif; float: right">ABC</span>Serif', 'cursive' => '<span style="font-family: cursive; float: right">ABC</span>Cursive', 'fantasy' => '<span style="font-family: fantasy; float: right">ABC</span>Fantasy', 'monospace' => '<span style="font-family: monospace; float: right">ABC</span>Monospace'), 'Dynamic' => 0, 'MenuStyle' => '', 'MenuClass' => 'groovymenu', 'ItemStyle' => '', 'SelectedItemStyle' => '', 'ItemClass' => 'groovyitem', 'SelectedItemClass' => 'groovyselecteditem', 'ShowButton' => 'show_fonts'));
/*
 * This code is necessary to handle the requests for fetching
 * auto-complete values.
 */
$form->HandleEvent($processed);
if ($processed) {
Ejemplo n.º 14
0
<?php

/*
 * test_upload.php
 *
 * @(#) $Header: /home/mlemos/cvsroot/forms/test_upload.php,v 1.8 2007/07/02 03:07:56 mlemos Exp $
 *
 */
require "forms.php";
$form = new form_class();
$form->NAME = "subscription_form";
$form->METHOD = "POST";
$form->ACTION = "";
$form->ENCTYPE = "multipart/form-data";
$form->debug = "trigger_error";
$form->ResubmitConfirmMessage = "Are you sure you want to submit this form again?";
$form->AddInput(array("TYPE" => "file", "NAME" => "userfile", "ACCEPT" => "image/gif", "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "It was not specified a valid file to upload"));
$form->AddInput(array("TYPE" => "submit", "VALUE" => "Upload", "NAME" => "doit"));
$form->AddInput(array("TYPE" => "hidden", "NAME" => "MAX_FILE_SIZE", "VALUE" => 1000000));
$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;
Ejemplo n.º 15
0
 *
 * @(#) $Header: /home/mlemos/cvsroot/forms/test_mdb2_linked_select.php,v 1.2 2006/12/20 06:21:17 mlemos Exp $
 *
 */
require 'MDB2.php';
require 'forms.php';
require 'form_linked_select.php';
require 'form_mdb2_linked_select.php';
$dsn = array("phptype" => "mysql", "username" => "mysqluser", "password" => "mysqlpassword", "database" => "locations", "Debug" => "error_log");
$database =& MDB2::connect($dsn);
if (PEAR::isError($database)) {
    var_dump($database->getMessage());
    die;
}
$continents = array("" => "Select continent", "na" => "North America", "eu" => "Europe", "sa" => "South America", "as" => "Asia", "oc" => "Oceania");
$form = new form_class();
$form->NAME = "location_form";
$form->METHOD = "GET";
$form->ACTION = "";
$form->debug = "OutputDebug";
$form->AddInput(array("TYPE" => "select", "ID" => "continent", "NAME" => "continent", "LABEL" => "<u>C</u>ontinent", "ACCESSKEY" => "C", "VALUE" => "", "OPTIONS" => $continents, "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "It was not specified a valid continent."));
$form->AddInput(array("TYPE" => "custom", "ID" => "country", "NAME" => "country", "LABEL" => "Coun<u>t</u>ry", "ACCESSKEY" => "t", "CustomClass" => "form_mdb2_linked_select_class", "Connection" => &$database, "OptionsQuery" => "SELECT code, name FROM countries WHERE continent=?", "DefaultOption" => "", "DefaultOptionValue" => "Select country", "Dynamic" => 1, "VALUE" => "", "LinkedInput" => "continent", "SIZE" => 3, "AutoWidthLimit" => 0, "AutoHeightLimit" => 0, "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "It was not specified a valid country."));
$form->AddInput(array("TYPE" => "custom", "ID" => "location", "NAME" => "location", "LABEL" => "<u>L</u>ocation", "ACCESSKEY" => "L", "CustomClass" => "form_mdb2_linked_select_class", "Connection" => &$database, "OptionsQuery" => "SELECT code, name FROM locations WHERE country=?", "DefaultOption" => "", "DefaultOptionValue" => "Select location", "Dynamic" => 1, "VALUE" => "", "LinkedInput" => "country", "SIZE" => 3, "AutoWidthLimit" => 0, "AutoHeightLimit" => 0, "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "It was not specified a valid location."));
$form->AddInput(array("TYPE" => "submit", "VALUE" => ">", "NAME" => "update", "SubForm" => "update"));
$form->AddInput(array("TYPE" => "submit", "VALUE" => "Go", "NAME" => "doit"));
$form->Connect("location", "doit", "ONCHANGE", "Click", array());
/*
 * This code is necessary to handle the requests for serving the
 * dynamically generated lists of options for linked select inputs.
 */
$form->HandleEvent($processed);
Ejemplo n.º 16
0
<?php

echo '<form action="index.php" method="POST"><input type=submit value=Anuluj class="butt4"></form>';
$sql = "select * from sl_gab";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
    $sl_gab[$row['id']] = $row['nazwa'];
}
require "./ajax/forms.php";
require "./ajax/form_layout_vertical.php";
require "./ajax/form_layout_paged.php";
require "./ajax/form_animation.php";
$form = new form_class();
$form->encoding = "utf-8";
$form->NAME = "subscription_form";
$form->METHOD = "POST";
$form->ACTION = "";
$form->debug = "trigger_error";
$form->ResubmitConfirmMessage = 'xx';
$form->OutputPasswordValues = 1;
$form->OptionsSeparator = "<br>\n";
$form->ShowAllErrors = 1;
$form->InvalidCLASS = 'butt4';
$form->AddInput(array("TYPE" => "text", "NAME" => "login", "ID" => "login", "MAXLENGTH" => 30, "SIZE" => 21, "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "Brak nazwy użytkownika", "LABEL" => "Nazwa użytkownika", "ACCESSKEY" => "I"));
$form->AddInput(array("TYPE" => "text", "NAME" => "nazwisko", "ID" => "nazwisko", "MAXLENGTH" => 30, "SIZE" => 21, "Capitalization" => "uppercase", "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "Brak nazwiska", "LABEL" => "Nazwisko", "ACCESSKEY" => "I"));
$form->AddInput(array("TYPE" => "text", "NAME" => "imie", "ID" => "imie", "MAXLENGTH" => 25, "SIZE" => 16, "Capitalization" => "uppercase", "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "Brak imienia", "LABEL" => "Imię", "ACCESSKEY" => "I"));
$form->AddInput(array("TYPE" => "password", "NAME" => "haslo", "ID" => "haslo", "MAXLENGTH" => 15, "SIZE" => 16, "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "Brak hasła", "LABEL" => "Hasło", "ACCESSKEY" => "I"));
$form->AddInput(array("TYPE" => "select", "NAME" => "gabinety", "ID" => "gabinety", "VALUE" => "2", "SIZE" => 8, "OPTIONS" => $sl_gab, "ValidationErrorMessage" => "Brak wybranego gabinetu", "LABEL" => "Gabinet"));
$form->AddInput(array("TYPE" => "text", "NAME" => "haslo_do", "ID" => "haslo_do", "MAXLENGTH" => 10, "SIZE" => 11, "Capitalization" => "uppercase", "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "Brak daty ważności hasła", "LABEL" => "Ważnośc hasła", "ACCESSKEY" => "I", "VALUE" => date("Y-m-d", strtotime("+30 days"))));
$form->AddInput(array("TYPE" => "checkbox", "NAME" => "akt", "ID" => "akt", "LABEL" => "Aktywny", "ACCESSKEY" => "I", "CHECKED" => 1));
$form->AddInput(array("TYPE" => "submit", "ID" => "button_subscribe", "NAME" => "user_new_zap", "VALUE" => "Zapisz", "ACCESSKEY" => "u"));
Ejemplo n.º 17
0
/*
 * test_ajax_form.php
 *
 * @(#) $Header: /home/mlemos/cvsroot/forms/test_ajax_form.php,v 1.7 2007/02/19 23:44:20 mlemos Exp $
 *
 */
/*
 * Include form class code.
 */
require "forms.php";
require "form_ajax_submit.php";
/*
 * Create a form object.
 */
$form = new form_class();
$form->NAME = "subscription_form";
$form->METHOD = "POST";
$form->ACTION = "";
$form->debug = "error_log";
$form->AddInput(array("TYPE" => "text", "NAME" => "description", "ID" => "description", "LABEL" => "<u>D</u>escription", "ACCESSKEY" => "D", "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "It was not specified a valid description."));
$form->AddInput(array("TYPE" => "file", "NAME" => "file", "ID" => "file", "LABEL" => "<u>F</u>ile", "ACCESSKEY" => "F", "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "It was not specified a valid file."));
$form->AddInput(array("TYPE" => "submit", "NAME" => "doit", "ID" => "doit", "VALUE" => "Submit"));
$form->AddInput(array("TYPE" => "custom", "NAME" => "sender", "ID" => "sender", "CustomClass" => "form_ajax_submit_class", "FeedbackElement" => "feedback", "SubmitFeedback" => '<img src="indicator.gif" width="16" height="16" /> Submitting form ...', "TimeoutFeedback" => 'The communication with the server has timed out.', "Timeout" => 60, "ONTIMEOUT" => "", "DebugConsole" => "debug_console"));
/*
 *  Connect the doit submit button to the sender AJAX submit input
 */
$form->Connect("doit", "sender", "ONCLICK", "Submit", array());
/*
 *  Handle client side events on the server side.
 *  Do not output anything before these lines.
Ejemplo n.º 18
0
<?php

/*
 * test_linked_select.php
 *
 * @(#) $Header: /home/mlemos/cvsroot/forms/test_linked_select.php,v 1.7 2006/12/20 06:21:16 mlemos Exp $
 *
 */
require "forms.php";
require "form_linked_select.php";
$continents = array("" => "Select continent", "na" => "North America", "eu" => "Europe", "sa" => "South America", "as" => "Asia", "oc" => "Oceania");
$countries = array("" => array("" => "Select country"), "na" => array("" => "Select country", "us" => "United States", "ca" => "Canada"), "eu" => array("" => "Select country", "pt" => "Portugal", "de" => "Germany"), "sa" => array("" => "Select country", "br" => "Brazil", "ar" => "Argentina"), "as" => array("" => "Select country", "jp" => "Japan", "kr" => "Korea"), "oc" => array("" => "Select country", "au" => "Australia", "nz" => "New Zeland"));
$locations = array("" => array("" => "Select location"), "us" => array("" => "Select location", "ny" => "New York", "la" => "Los Angeles"), "ca" => array("" => "Select location", "to" => "Toronto", "mo" => "Montréal"), "pt" => array("" => "Select location", "li" => "Lisbon", "av" => "Aveiro"), "de" => array("" => "Select location", "fr" => "Frankfurt", "be" => "Berlin"), "br" => array("" => "Select location", "sa" => "São Paulo", "ri" => "Rio de Janeiro"), "ar" => array("" => "Select location", "bu" => "Buenos Aires", "ma" => "Mar del Plata"), "jp" => array("" => "Select location", "to" => "Tokio", "os" => "Osaka"), "kr" => array("" => "Select location", "se" => "Seoul", "yo" => "Yosu"), "au" => array("" => "Select location", "sy" => "Sydney", "me" => "Melbourne"), "nz" => array("" => "Select location", "we" => "Wellington", "au" => "Auckland"));
$form = new form_class();
$form->NAME = "location_form";
$form->METHOD = "POST";
$form->ACTION = "";
$form->debug = "error_log";
$form->AddInput(array("TYPE" => "select", "ID" => "continent", "NAME" => "continent", "LABEL" => "<u>C</u>ontinent", "ACCESSKEY" => "C", "VALUE" => "", "OPTIONS" => $continents, "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "It was not specified a valid continent."));
$form->AddInput(array("TYPE" => "custom", "ID" => "country", "NAME" => "country", "LABEL" => "Coun<u>t</u>ry", "ACCESSKEY" => "t", "CustomClass" => "form_linked_select_class", "VALUE" => "", "Groups" => $countries, "LinkedInput" => "continent", "AutoWidthLimit" => 0, "AutoHeightLimit" => 0, "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "It was not specified a valid country."));
$form->AddInput(array("TYPE" => "custom", "ID" => "location", "NAME" => "location", "LABEL" => "<u>L</u>ocation", "ACCESSKEY" => "L", "CustomClass" => "form_linked_select_class", "VALUE" => "", "Groups" => $locations, "LinkedInput" => "country", "AutoWidthLimit" => 0, "AutoHeightLimit" => 0, "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "It was not specified a valid location."));
$form->AddInput(array("TYPE" => "submit", "VALUE" => ">", "NAME" => "update", "SubForm" => "update"));
$form->AddInput(array("TYPE" => "submit", "VALUE" => "Go", "NAME" => "doit"));
$form->Connect("location", "doit", "ONCHANGE", "Click", array());
/*
 * This code is necessary to handle the requests for serving the
 * dynamically generated lists of options for linked select inputs.
 */
$form->HandleEvent($processed);
if ($processed) {
    exit;
Ejemplo n.º 19
0
<?php

/*
 *
 * @(#) $Id: test_html_editor.php,v 1.6 2009/09/26 06:12:06 mlemos Exp $
 *
 */
require 'forms.php';
require 'form_html_editor.php';
$form = new form_class();
$form->NAME = 'html_editor_form';
$form->METHOD = 'POST';
$form->ACTION = '';
$form->ONSUBMIT = 'return false';
$form->debug = 'trigger_error';
$form->AddInput(array('TYPE' => 'custom', 'ID' => 'editor', 'CustomClass' => 'form_html_editor_class', 'NAME' => 'editor', 'ROWS' => 20, 'COLS' => 80, 'VALUE' => '<h1>Hello world!</h1>{menu sad}<p>{smiley}</p>', 'Debug' => 1, 'STYLE' => 'width: 800px; height: 600px; background-color: #ffffff; border-style: solid; border-width: 1px; margin: 0px; border-color:  #707070 #e0e0e0 #e0e0e0 #707070', 'JavascriptPath' => '', 'TemplateVariables' => array('menu' => array('Preview' => '<a href="">File</a> <a href="">Edit</a> <a href="">Tools</a> <a href="">Help</a>', 'Inline' => 0, 'Title' => 'Menu', 'Alternatives' => array('vertical' => array('Preview' => '<a href="">File</a><br /><a href="">Edit</a><br /><a href="">Tools</a><br /><a href="">Help</a>', 'Title' => 'Vertical menu'))), 'smiley' => array('Preview' => ';-)', 'Inline' => 1, 'Title' => 'Smiley', 'Alternatives' => array('sad' => array('Preview' => ':-(', 'Title' => 'Sad'), 'grin' => array('Preview' => ':D', 'Title' => 'Grin'), 'shocked' => array('Preview' => ':O', 'Title' => 'Shocked'))))));
$form->AddInput(array('TYPE' => 'submit', 'ID' => 'send', 'NAME' => 'send', 'VALUE' => 'Submit'));
$head = $form->PageHead();
$onload = $form->PageLoad();
$onunload = $form->PageUnload();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test for Manuel Lemos' PHP form class
using the HTML editor plug-in</title>
<?php 
echo $head;
?>
<style type="text/css">
.editor { background-color: blue; font-family: "courier" }
Ejemplo n.º 20
0
 * @(#) $Header: /home/mlemos/cvsroot/forms/test_mysql_auto_complete.php,v 1.2 2006/12/20 06:21:17 mlemos Exp $
 *
 */
require 'forms.php';
require 'form_ajax_submit.php';
require 'form_auto_complete.php';
require 'form_mysql_auto_complete.php';
$host = "localhost";
$user = "******";
$password = "******";
$database = "medicus";
$connection = @mysql_pconnect($host, $user, $password);
if ($connection) {
    mysql_select_db($database, $connection);
}
$form = new form_class();
$form->NAME = 'auto_complete_form';
$form->METHOD = 'POST';
$form->ACTION = '';
$form->debug = 'error_log';
$form->AddInput(array('TYPE' => 'text', 'ID' => 'location', 'NAME' => 'location', 'LABEL' => '<u>L</u>ocation', 'ACCESSKEY' => 'L', 'VALUE' => '', 'ExtraAttributes' => array('autocomplete' => 'off', 'title' => 'Type just the first letters of a location.')));
$form->AddInput(array('TYPE' => 'button', 'NAME' => 'show_locations', 'ID' => 'show_locations', 'VALUE' => '...', 'ExtraAttributes' => array('title' => 'Click to show all locations.')));
$form->AddInput(array('TYPE' => 'custom', 'ID' => 'complete_location', 'NAME' => 'complete_location', 'CustomClass' => 'form_mysql_auto_complete_class', 'CompleteInput' => 'location', 'CompleteMinimumLength' => 1, 'Dynamic' => 1, 'ShowButton' => 'show_locations', "Connection" => $connection, "CompleteValuesQuery" => "SELECT nazwa FROM sl_bloz WHERE nazwa {BEGINSWITH} ORDER BY nazwa", "CompleteValuesLimit" => 10, 'FeedbackElement' => 'complete_location_feedback', 'SubmitFeedback' => ' <img src="indicator.gif" width="16" height="16" alt="Looking up for locations" title="Looking up for locations" /> ', 'CompleteFeedback' => ' <img src="indicator.gif" width="16" height="16" style="visibility: hidden;" /> ', 'MenuClass' => 'groovymenu', 'MenuStyle' => '', 'ItemClass' => 'groovyitem', 'ItemStyle' => '', 'SelectedItemClass' => 'groovyselecteditem', 'SelectedItemStyle' => ''));
/*
 * This code is necessary to handle the requests for fetching
 * auto-complete values.
 */
$form->HandleEvent($processed);
if ($processed) {
    exit;
}
Ejemplo n.º 21
0
<?php

/*
 *
 * @(#) $Id: test_animation.php,v 1.4 2008/09/07 06:24:27 mlemos Exp $
 *
 */
require 'forms.php';
require 'form_animation.php';
$form = new form_class();
$form->NAME = 'animation_form';
$form->METHOD = 'POST';
$form->ACTION = '';
$form->debug = 'trigger_error';
$form->AddInput(array('TYPE' => 'custom', 'ID' => 'animation', 'CustomClass' => 'form_animation_class', 'JavascriptPath' => ''));
$form->AddInput(array('TYPE' => 'button', 'ID' => 'show', 'VALUE' => 'fade in'));
$form->AddInput(array('TYPE' => 'button', 'ID' => 'hide', 'VALUE' => 'fade out'));
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test for Manuel Lemos' PHP form class
using the animation plug-in</title>
<?php 
echo $form->PageHead();
?>
</head>
<body bgcolor="#cccccc">
<center><h1>Test for Manuel Lemos' PHP form class
using the animation plug-in</h1></center>
<hr />
Ejemplo n.º 22
0
<?php

/*
 * This example serves to demonstrate how to validate an input depending
 * on the state of another input.
 *
 * @(#) $Id: test_dependent_validation.php,v 1.1 2007/06/02 08:37:21 mlemos Exp $
 *
 */
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 = '';
Ejemplo n.º 23
0
/*
 *  Include the AJAX submit plug-in class to automatically interact with
 *  the server without reloading the page
 */
require 'form_ajax_submit.php';
/*
 *  Include the blog post view class and initialize the object to define
 *  details of presentation of the forms and listings of the posts being
 *  edited
 */
require 'blog_post_view.php';
$view = new blog_post_view_class();
if (!$view->Initialize()) {
    die('Error: ' . $model->error);
}
$form = new form_class();
$form->NAME = 'scaffolding_form';
$form->METHOD = 'POST';
$form->ACTION = defined('SCAFFOLDING_URI') ? SCAFFOLDING_URI : '?';
$form->InvalidCLASS = $view->GetInvalidInputsClass();
$form->ShowAllErrors = 1;
$form->ErrorMessagePrefix = '- ';
$form->debug = 'trigger_error';
/*
 *  Include the blog post model class and initialize the object to store
 *  and retrieve data of the post entries being edited
 */
require 'blog_post_model.php';
$model = new blog_post_model_class();
if (!$model->Initialize()) {
    die('Error: ' . $model->error);