目次 |
<form method="post" action="<?= h($view->action('go_to_conf')) ?>">
<?=Core::make('token')->output('go_to_conf');?>
<p style="font-size: 20px;font-weight: 700; color: darkgoldenrod;"><?= $message ?></p>
<div class="form-group">
<label class="control-label"><?= h('Text Field') ?></label>
<?= $form->text('foo_bar_text_field') ?>
</div>
<div class="form-group">
<input type="submit" name="submit" value="submit" class="btn btn-default"/>
</div>
</form>
public function action_go_to_conf($bID = false)
{
$token = \Core::make("token");
if ($this->bID == $bID && $token->validate('go_to_conf')) {
$this->set('message', h('Conf Page'));
$fooBarTextField = $this->get('foo_bar_text_field');
$input['foo_bar_text_field'] = $fooBarTextField;
$this->set('input', $input);
$this->set('mode', h('conf'));
return true;
}
}
<!--確認画面-->
<p style="font-size: 20px;font-weight: 700; color: darkgoldenrod;"><?= h($message) ?></p>
<p>Your input is <span style="font-size:20px; font-weight:700;"><?= h($input['foo_bar_text_field']) ?></span>.</p>
<div style="display:flex;">
<form method="post" action="<?= h($view->action('go_to_comp')) ?>" style="margin-right: 10px;">
<div class="form-group">
<input type="submit" name="submit" value="submit" class="btn btn-default"/>
</div>
</form>
<form method="post" action="<?= h($view->action('back_to_edit')) ?>" class="test">
<div class="form-group">
<?= $form->hidden('foo_bar_text_field', h($input['foo_bar_text_field'])) ?>
<div class="form-group">
<input type="submit" name="submit" value="back" class="btn btn-default"/>
</div>
</div>
</form>
</div>
public function action_go_to_comp($bID = false)
{
if ($this->bID == $bID) {
$this->set('message', h('Comp Page'));
$this->set('response', h('Thanks!'));
$this->set('mode', h('comp'));
return true;
}
}
public function action_back_to_edit($bID = false)
{
if ($this->bID == $bID) {
$this->set('mode', h('edit'));
return true;
}
}
<form method="post" action="<?= h($view->action('back_to_edit')) ?>" class="test">
<div class="form-group">
//ここ↓
<?= $form->hidden('foo_bar_text_field', h($input['foo_bar_text_field'])) ?>
<div class="form-group">
<input type="submit" name="submit" value="back" class="btn btn-default"/>
</div>
</div>
</form>
$this->set('mode', h('conf'));
<?=Core::make('token')->output('go_to_conf');?>
//トークン
$token = \Core::make("token")
//真偽値チェック
$token->validate('go_to_conf')
<?php
namespace Application\Block\ExternalForm\Form\Controller;
use Concrete\Core\Controller\AbstractController;
class FoobarForm extends AbstractController
{
public function view()
{
$this->set('message', h('Edit Page'));
$this->set('mode', 'edit');
}
public function action_go_to_conf($bID = false)
{
$token = \Core::make("token");
if ($this->bID == $bID && $token->validate('go_to_conf')) {
$this->set('message', h('Conf Page'));
$fooBarTextField = $this->get('foo_bar_text_field');
$input['foo_bar_text_field'] = $fooBarTextField;
$this->set('input', $input);
$this->set('mode', h('conf'));
return true;
}
}
public function action_go_to_comp($bID = false)
{
if ($this->bID == $bID) {
$this->set('message', h('Comp Page'));
$this->set('response', h('Thanks!'));
$this->set('mode', h('comp'));
return true;
}
}
public function action_back_to_edit($bID = false)
{
if ($this->bID == $bID) {
$this->set('mode', h('edit'));
return true;
}
}
}
<?php
$form = Loader::helper('form');
defined('C5_EXECUTE') or die("Access Denied.");
if (isset($response)) {
?>
<div class="alert alert-info"><?= h($response) ?></div>
<?php
} ?>
<?php
if ($mode === 'edit') {
?>
<!--入力画面-->
<form method="post" action="<?= h($view->action('go_to_conf')) ?>">
<?=Core::make('token')->output('go_to_conf');?>
<p style="font-size: 20px;font-weight: 700; color: darkgoldenrod;"><?= $message ?></p>
<div class="form-group">
<label class="control-label"><?= h('Text Field') ?></label>
<?= $form->text('foo_bar_text_field') ?>
</div>
<div class="form-group">
<input type="submit" name="submit" value="submit" class="btn btn-default"/>
</div>
</form>
<?php } else if ($mode === 'conf') { ?>
<!--確認画面-->
<p style="font-size: 20px;font-weight: 700; color: darkgoldenrod;"><?= h($message) ?></p>
<p>Your input is <span style="font-size:20px; font-weight:700;"><?= h($input['foo_bar_text_field']) ?></span>.</p>
<div style="display:flex;">
<form method="post" action="<?= h($view->action('go_to_comp')) ?>" style="margin-right: 10px;">
<div class="form-group">
<input type="submit" name="submit" value="submit" class="btn btn-default"/>
</div>
</form>
<form method="post" action="<?= h($view->action('back_to_edit')) ?>" class="test">
<div class="form-group">
<?= $form->hidden('foo_bar_text_field', h($input['foo_bar_text_field'])) ?>
<div class="form-group">
<input type="submit" name="submit" value="back" class="btn btn-default"/>
</div>
</div>
</form>
</div>
<?php } else {
?>
<!--完了画面-->
<p style="font-size: 20px;font-weight: 700; color: darkgoldenrod;"><?= h($message) ?></p>
<?php }