當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HTML_QuickForm2::addRecursiveFilter方法代碼示例

本文整理匯總了PHP中HTML_QuickForm2::addRecursiveFilter方法的典型用法代碼示例。如果您正苦於以下問題:PHP HTML_QuickForm2::addRecursiveFilter方法的具體用法?PHP HTML_QuickForm2::addRecursiveFilter怎麽用?PHP HTML_QuickForm2::addRecursiveFilter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HTML_QuickForm2的用法示例。


在下文中一共展示了HTML_QuickForm2::addRecursiveFilter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

$stadBostad = $fsMalsman->addElement('text', 'stadBostad', array('style' => 'width: 300px;'), array('label' => 'Stad:'));
$stadBostad->addRule('maxlength', 'Stadens namn får max vara 20 tecken.', 20);
$statBostad = $fsMalsman->addElement('text', 'statBostad', array('style' => 'width: 300px;'), array('label' => 'Stat:'));
$statBostad->addRule('maxlength', 'Statsnamnet får max vara 20 tecken.', 20);
$telefonBostad = $fsMalsman->addElement('text', 'telefonBostad', array('style' => 'width: 300px;'), array('label' => 'Telefonnummer bostad:'));
$telefonBostad->addRule('maxlength', 'Telefonnumret får max vara 20 tecken.', 20);
$mobilMalsman = $fsMalsman->addElement('text', 'mobilMalsman', array('style' => 'width: 300px;'), array('label' => 'Mobilnummer:'));
$mobilMalsman->addRule('maxlength', 'Mobilnumret får max vara 20 tecken.', 20);
$ePostMalsman = $fsMalsman->addElement('text', 'ePostMalsman', array('style' => 'width: 300px;'), array('label' => 'E-postadress:'));
$ePostMalsman->addRule('required', 'Fyll i målsmans e-postadress');
$ePostMalsman->addRule('regex', 'Det är inte en korrekt e-postadress.', "/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}\$/");
$ePostMalsman->addRule('maxlength', 'E-postadressen får max vara 50 tecken.', 50);
// Sändknappen
$submitButton = $form->addElement('submit', 'submit', array('value' => 'Skicka'));
// Tar bort 'space' först och sist på alla värden.
$form->addRecursiveFilter('trim');
$mainTextHTML = "";
if ($form->validate()) {
    //Om sidan är riktigt ifylld.
    $mainTextHTML .= "<h2>Din information har skickats till Svenska \n        Skolföreningen. Tack för din anmälan!</h2>";
    $eMailAdr = "registrering@svenskaskolankualalumpur.com";
    $subject = "Ny anmälan till SSKL";
    $headers = WS_MAILHEADERS;
    $text = "Ny anmälan till Svenska Skolföreningen i Kuala Lumpur. \n";
    foreach ($form->getValue() as $parameter => $value) {
        $text .= $parameter . "\t" . $value . "\n";
    }
    mail($eMailAdr, $subject, $text, $headers);
    $form->removeChild($submitButton);
    // Tag bort sänd-knappen.
    $form->removeChild($kommentar);
開發者ID:GunnarWinqvist,項目名稱:SSKL,代碼行數:31,代碼來源:PApplication.php

示例2: testContainerValidation

 public function testContainerValidation()
 {
     $form = new HTML_QuickForm2('filters', 'post', null, false);
     $username = $form->addElement('text', 'foo');
     $username->addRule('required', 'Username is required');
     $form->addRecursiveFilter('trim');
     $this->assertFalse($form->validate());
     $this->assertSame('', $username->getValue());
 }
開發者ID:andreaswarnaar,項目名稱:HTML_QuickForm2.1,代碼行數:9,代碼來源:FilterTest.php


注:本文中的HTML_QuickForm2::addRecursiveFilter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。