name all form field
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
|
||||
<forms>
|
||||
<form name="thelia.customer.creation" class="Thelia\Form\CustomerCreation"/>
|
||||
<form name="thelia.admin_login" class="Thelia\Form\AdminLogin"/>
|
||||
</forms>
|
||||
|
||||
|
||||
|
||||
@@ -90,8 +90,10 @@ class Form implements SmartyPluginInterface
|
||||
$instance = $this->getInstance($params['name']);
|
||||
$form = $instance->getForm();
|
||||
|
||||
if (true === $this->request->getSession()->get("form_error", false) && $this->request->getSession()->get
|
||||
("form_name") == $instance->getName()) {
|
||||
if (
|
||||
true === $this->request->getSession()->get("form_error", false) &&
|
||||
$this->request->getSession()->get("form_name") == $instance->getName())
|
||||
{
|
||||
$form->bind($this->request);
|
||||
$this->request->getSession()->set("form_error", false);
|
||||
}
|
||||
|
||||
@@ -41,4 +41,9 @@ class AdminLogin extends BaseForm {
|
||||
->add("password", "password");
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "admin_login";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -61,7 +61,7 @@ abstract class BaseForm {
|
||||
)
|
||||
->addExtension(new ValidatorExtension($validator))
|
||||
->getFormFactory()
|
||||
->createBuilder($type, $data, $options);
|
||||
->createNamedBuilder($this->getName(), $type, $data, $options);
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,21 @@ An image from asset directory :
|
||||
<input type="submit" value="valider">
|
||||
</form>
|
||||
{/form}
|
||||
|
||||
<br />
|
||||
|
||||
{form name="thelia.admin_login"}
|
||||
<form method="post" action="#" {form_enctype form=$form} >
|
||||
{form_field_hidden form=$form}
|
||||
{form_field form=$form.username}
|
||||
username : <input type="text" name="{$name}" {$attr}>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form.password}
|
||||
password : <input type="password" name="{$name}" {$attr}>
|
||||
{/form_field}
|
||||
</form>
|
||||
{/form}
|
||||
<div>
|
||||
jQuery data: <span id="jquery_block"></span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user