this is my view :
{{ content() }}
<ul class="pager">
<li class="previous pull-left">
{{ link_to("itk/search", "← Retour") }}
</li>
<li class="pull-right">
</li>
</ul>
<h3>Nouvelle intervention</h3>
<div class="well">
{{ form(" itk/create", 'class': 'form-horizontal') }}
<fieldset>
{% for element in form %}
{% if is_a(element, 'Phalcon\Forms\Element\Hidden') %}
{{ element }}
{% else %}
<div class="form-group">
{{ element.label(['class': 'col-sm-4 control-label']) }}
<div class="col-sm-4">
{{ element.render(['class': 'form-control', 'rows': '' ]) }}
</div>
</div>
{% endif %}
{% endfor %}
</fieldset>
<div class="form-group">
{{ submit_button("Sauvegarder", "class": "btn btn-success") }}
</div>
</form>
</div>
this is my function createAction():
if (!$this->request->isPost()) {
return $this->forward("itk/recherche");
}
$form = new ItkForm;
$itk = new Itk();
$data = $this->request->getPost();
if (!$form->isValid($data, $itk)) {
foreach ($form->getMessages() as $message) {
$this->flash->error($message);
}
return $this->forward('itk/new');
}
if ($itk->save() == false) {
foreach ($itk->getMessages() as $message) {
$this->flash->error($message);
}
return $this->forward('itk/new');
}
$form->clear();
$this->flash->success("Intervention créée avec succès");
return $this->forward("itk/search");
thank you