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