Added new form type

This commit is contained in:
Antonio de la Rosa 2015-08-25 21:36:07 +02:00
parent 7ab106db62
commit 7be0c01588
5 changed files with 67 additions and 13 deletions

View file

@ -9,6 +9,7 @@
*/
namespace PhangoApp\PhaModels\CoreFields;
use PhangoApp\PhaModels\Forms\BaseForm;
use PhangoApp\PhaUtils\Utils;
class PasswordField extends CharField {
@ -63,6 +64,24 @@ class PasswordField extends CharField {
return false;
}
/**
* By default primaryfield use a hidden form
*/
public function create_form()
{
$form=new BaseForm($this->name_component, $this->value);
$form->default_value=$this->default_value;
$form->required=$this->required;
$form->label=$this->label;
$form->type='password';
return $form;
}
}

View file

@ -172,7 +172,7 @@ class PhangoField {
public function create_form()
{
$form=new BaseForm($this->name, $this->value);
$form=new BaseForm($this->name_component, $this->value);
$form->default_value=$this->default_value;
$form->required=$this->required;
$form->label=$this->label;

View file

@ -2,6 +2,7 @@
namespace PhangoApp\PhaModels\CoreFields;
use PhangoApp\PhaUtils\Utils;
use PhangoApp\PhaModels\Forms\BaseForm;
/**
* PrimaryField is used for primary keys for models
@ -77,6 +78,23 @@ class PrimaryField extends PhangoField {
return $value;
}
/**
* By default primaryfield use a hidden form
*/
public function create_form()
{
$form=new BaseForm($this->name_component, $this->value);
$form->default_value=$this->default_value;
$form->required=$this->required;
$form->label=$this->label;
$form->type='hidden';
return $form;
}
}