Created
February 25, 2013 16:04
-
-
Save jbroadway/5030841 to your computer and use it in GitHub Desktop.
Creating a yes/no select box form element in Elefant.
This file contains 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
<!-- apps/demo/views/yesno.html --> | |
<form method="post" id="{{_form}}"> | |
<p> | |
Yes/no:<br /> | |
<select name="yesno"> | |
<option value="yes"{% if yesno === 'yes' %} selected{% end %}>{"Yes"}</option> | |
<option value="no"{% if yesno === 'no' %} selected{% end %}>{"No"}</option> | |
</select> | |
</p> | |
<p><input type="submit" value="{"Submit"}" /></p> | |
</form> |
This file contains 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 // apps/demo/handlers/yesno.php | |
$page->layout = 'admin'; | |
$page->title = __ ('Yes/No Example'); | |
$form = new Form ('post', $this); | |
// set the default to 'no' | |
$form->data = array ('yesno' => 'no'); | |
echo $form->handle (function ($form) use ($page) { | |
$page->title = __ ('You Chose:'); | |
printf ('<p>%s</p>', $_POST['yesno']); | |
}); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment