addCssClasses('testform') ->showMessages('Fehler:') //->showCustomMessages('Fehler:') ->setLanguage('german') ->useExternalFormDeclaration() ->setPackagePath('/////htmlform///') ->setEnctype('multipart/form-data') ->useReducedErrorMarking() ; $testFieldSet = FieldSet::get()->setLegend('testfieldset'); $testFieldSet->addElement( CustomHtml::get() ->setHtml('') ); $testFieldSet->addElement( InputText::get('testinputtext') ->setLabel('email') ->setText('ich@du.de') ->setCssClasses('bordered') ->setSize(25) ->setMaxLength(10) ->setValidator( FormValidator::get() ->setEmail() ->setCustomCase(true) ) ->refill() ); $testFieldSet->addElement( Select::get('testselectsingle') ->setOptions(array('String-Werte' => array('a' => 'test1', 'b' => 'test2'), 'Zahlenwerte' => array('3' => '333'), 'c' => 'test3')) ->setSelectedSingle('333') ->setLabel('Einzelselect nur Zahlen') ->setValidator( FormValidator::get() ->setDigits() ->setErrorMessage('Bitte einen Wert wählen, der nur aus Zahlen besteht!') ) ->refill() ); $testFieldSet->addElement( Select::get('testselectsinglemixed') ->setOptions(array('0' => '---', 'b' => 'juhu', 'c' => 'lalala')) ->setLabel('Einzelselect Mischwerte') ->setValidator( FormValidator::get() ->setRequired() ) ->refill() ); $testFieldSet->addElement( Select::get('testselectmultiple') ->setMultiple() ->setOptions(array('a' => 'test1', 'b' => 'test2', 'c' => 'test3')) ->setOptionCssClasses(array('odd', 'even')) ->setOptionTitles(array('eins', 'zwei')) ->setSelectedIndices(array(1, 3)) ->setSize(3) ->setLabel('testmultiselect') ->refill() ->setValidator( FormValidator::get() ->setRequired() ->setCharacterClass('ac') ->setAutoErrorMessagesAsCustom() ) ); $testFieldSet->addElement( InputText::get('datetest') ->setLabel('Standarddatum') ->setText('1/12/2002') ->setValidator( FormValidator::get() ->setDate() ->setOptional() ) ->refill() ); $testFieldSet->addElement( InputText::get('dateisotest') ->setLabel('ISO-Datum') ->setText('2002-12-1') ->setValidator( FormValidator::get() ->setDateISO() ) ->refill() ); $testFieldSet->addElement( InputText::get('datedetest') ->setLabel('deutsches Datum') ->setText('1.12.2002') ->setValidator( FormValidator::get() ->setDateDE() ) ->refill() ); $testFieldSet->addElement( InputText::get('numbertest') ->setLabel('englische Dezimalzahl') ->setText('100.1') ->setValidator( FormValidator::get() ->setNumber() ) ->refill() ); $testFieldSet->addElement( InputText::get('numberdetest') ->setLabel('deutsche Dezimalzahl') ->setText('100,1') ->setValidator( FormValidator::get() ->setNumberDE() ) ->refill() ); $testFieldSet->addElement( InputPassword::get('pass1') ->setLabel('passwordtest1') ->setText('test') ->setMaxLength(8) ->refill() ); $testFieldSet->addElement( InputFile::get('file1') ->setLabel('filetest1') ->setText('test') ->setAccept('text/*') ); $testForm->addElement($testFieldSet); $testAlignBlock = AlignBlock::get(); $testAlignBlock->addElement( InputSubmit::get('save', 'save') ->setCaption('Abschicken') ); $testAlignBlock->addElement( InputButton::get('cancel', 'cancel') ->setCaption('Abbrechen') ->setDisabled() ); $testForm->addElement($testAlignBlock); $testForm->addCell(); $testFieldSet2 = FieldSet::get()->setLegend('testfieldset2'); $testFieldSet2->addElement( InputText::get('testtextinput2') ->setLabel('Länge zwischen 3 und 10') ->setText('testotesto') ->setTitle('testtitle') ->setValidator( FormValidator::get() ->setRequired() ->setMinLength(3) ->setMaxLength(10) ->setCharacterClass('a-zA-ZäöüÄÖÜß') ) ->refill() ); $testFieldSet2->addElement( InputText::get('testtextinput3') ->setLabel('Länge zwischen 4 und 6') ->setText('testo') ->setValidator( FormValidator::get() ->setRangeLength(array(4,6)) ) ->refill() ); $testFieldSet2->addElement( InputText::get('testtextinput5') ->setLabel('zwischen 3 und 10') ->setText('4') ->setValidator( FormValidator::get() ->setMin(3) ->setMax(10) ) ->refill() ); $testFieldSet2->addElement( InputText::get('testtextinput6') ->setLabel('zwischen 4 und 6') ->setText('5') ->setValidator( FormValidator::get() ->setRange(array(4, 6)) ) ->refill() ); $testFieldSet2->addElement( InputText::get('testtextinput4') ->setLabel('url') ->setCssClasses('bordered') ->setText('http://www.100sonnen.de') ->setValidator( FormValidator::get() ->setUrl() ) ->refill() ); $testFieldSet2->addElement( InputRadio::get('radios1') ->setLabel('radiotest1') ->setOptions(array('a' => 'radio1', 'b' => 'radio2', 'c' => 'radio3', 'd' => 'radio4')) ->setSelectedValue('d') ->setWidth(3) ->refill() ); $checkbox1 = InputCheckbox::get('check1') ->setLabel('checktest1') ->setCssClasses('test') ->setOptions(array('a' => 'check1', 'b' => 'check2', 'c' => 'check3', 'd' => 'check4')) ->setOptionCssClasses(array('odd', 'equal', 'even')) ->setSelected(array('check2', 'check3')) ; $testFieldSet2->addElement($checkbox1); $testFieldSet2->addElement( JsDateTime::get('cal1', 'cal1') ->setLabel('datetimetest1') ->setText('12.12.2008') ->setReadonly() ->setUpAsGermanDate() ->setAmPmTime() ->setArrowSelection() ->showTime() ->setJsConfigVars( array( 'WeekChar' => 3, 'SundayColor' => '#ffffff', 'SaturdayColor' => '#ffffff', 'WeekDayColor' => '#eeeeee' ) ) ->setValidator( FormValidator::get() ->setDateDE() ) ->refill() ); $testFieldSet2->addElement( TextArea::get('textarea1') ->setLabel('Fließtext (nur Buchstaben, Leer- und Satzzeichen)') ->setJsEventHandler('onclick', 'alert(\'onclick-test\');') ->setText('Hallo Welt!') ->setSize(20, 10) ->setValidator( FormValidator::get() ->setCustomCase( preg_match('/^[a-zA-ZäöüÄÖÜß!.,? ]+$/u', isset($_REQUEST['textarea1']) ? $_REQUEST['textarea1'] : 'Hallo Welt!') ? '' : 'Keinen Murks in den Fließtext ey!' ) ) ->refill() ); $testForm->addElement($testFieldSet2, 2); $testForm->insertElementAfter('testselectmultiple', CustomHtml::get() ->setHtml('
Dieser Teil wurde im Nachhinein in das Formular injiziert.
') ); $testForm->setHeadline('Dies ist eine Testüberschrift'); $testForm->setExplanation('Dies ist eine Testerklärung eines HTML-Formulars.'); $checkbox1->refill(); $testForm->validate(); $valSet = $testForm->getValueSet(); ?>