Fixes for use enctype in forms
This commit is contained in:
parent
c423cb0b9c
commit
f5d9fbd308
4 changed files with 24 additions and 0 deletions
|
|
@ -150,6 +150,8 @@ class ImageField extends PhangoField {
|
|||
|
||||
}
|
||||
|
||||
$this->std_error=I18n::lang('common', 'no_image_found', 'No image uploaded, check enctype form');
|
||||
|
||||
return false;
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -19,6 +19,12 @@ class BaseForm {
|
|||
|
||||
public $std_error='';
|
||||
|
||||
/**
|
||||
* A property for add enctype for a form where this field is used
|
||||
*/
|
||||
|
||||
public $enctype=0;
|
||||
|
||||
public function __construct($name, $value)
|
||||
{
|
||||
$this->label=$name;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class FileForm extends BaseForm{
|
|||
parent::__construct($name, $value);
|
||||
|
||||
$this->type='file';
|
||||
$this->enctype=1;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -157,6 +157,12 @@ class Webmodel {
|
|||
|
||||
public $enctype='';
|
||||
|
||||
/**
|
||||
* Internal variable for check if forms use enctype parameters...
|
||||
*/
|
||||
|
||||
public $check_enctype=0;
|
||||
|
||||
/**
|
||||
* Array used for inverse foreign keys.
|
||||
*
|
||||
|
|
@ -1607,6 +1613,13 @@ class Webmodel {
|
|||
}
|
||||
|
||||
$this->create_form($component_name);
|
||||
|
||||
if($this->check_enctype>0)
|
||||
{
|
||||
|
||||
$this->set_enctype_binary();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1654,6 +1667,8 @@ class Webmodel {
|
|||
$this->forms[$component_name]->required=$component->required;
|
||||
$this->forms[$component_name]->label=$component->label;
|
||||
|
||||
$this->check_enctype+=$this->forms[$component_name]->enctype;
|
||||
|
||||
$this->components[$component_name]->form_loaded=&$this->forms[$component_name];
|
||||
|
||||
$this->components[$component_name]->get_parameters_default();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue