Last active
December 15, 2015 03:19
-
-
Save ringmaster/5193039 to your computer and use it in GitHub Desktop.
Form Sample Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
FormUI::register('registered_form', function(FormUI $form) { | |
$wrap = $form->append(FormControlWrapper::create('wrap')->set_wrap_each('<div>%s</div>')); | |
$wrap->append(FormControlLabel::wrap('Sample 1:', new FormControlText('sample1', 'sample1'))); | |
$wrap->append(FormControlLabel::wrap('Right-side label', new FormControlText('sample2', 'sample2'))->set_template('control.label.onright')); | |
$wrap->append(FormControlLabel::wrap('Custom right-side label', new FormControlText('sample3', 'sample3'))->set_template_html(function($theme, $control) { | |
return $theme->content . '<label ' . $theme->_attributes . '>' . $theme->label . '</label>'; | |
})); | |
}); | |
$html = FormUI::build('test1', 'registered_form')->get(); | |
$t = new \tidy(); | |
$t->parseString($html, array('indent' => true, 'wrap' => 80, 'show-body-only' => true)); | |
echo $t; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form enctype="application/x-www-form-urlencoded" accept_charset="UTF-8" id= | |
"test1" name="test1"> | |
<input type="hidden" value= | |
"{SSHA512}FuLhTOWJKpFztBL4TFQIJQLdiasXNh7o/T32aXnXFWYxYhu8tIR769ct6bgPSTOabsoAhTNjCsRmwrdW3YTl6wTOCGM=" | |
name="nonce" id="nonce"><input type="hidden" value= | |
"jW+OQtDqOlBBDBBopYc5O5iDTGI=" name="digest" id="digest"><input type="hidden" | |
value="2013-03-19T15:38:26+00:00" name="timestamp" id="timestamp"> | |
<input type="hidden" name="_form_id" value= | |
"0b0f6315b6f764dfa79ead7b3ecbdb43"> | |
<div> | |
<div> | |
<label for="sample1">Sample 1:<input type="text" id="sample1" name= | |
"sample1"></label> | |
</div> | |
<div> | |
<label for="sample2"><input type="text" id="sample2" name= | |
"sample2">Right-side label</label> | |
</div> | |
<div> | |
<input type="text" id="sample3" name="sample3"><label for= | |
"sample3">Custom right-side label</label> | |
</div> | |
</div> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment