Little fixes

This commit is contained in:
Antonio de la Rosa 2015-12-16 15:28:10 +01:00
parent 1c88f85a99
commit 243767bc12
4 changed files with 28 additions and 1 deletions

View file

@ -48,6 +48,7 @@ class CharField extends PhangoField {
/**
* This function is for check if the value for field is valid
* If required and empty check how false
*/
public function check($value)
@ -55,6 +56,14 @@ class CharField extends PhangoField {
//Delete Javascript tags and simple quotes.
$this->value=Utils::form_text($value);
if($value=='')
{
$this->error=1;
}
return Utils::form_text($value);
}

View file

@ -120,6 +120,11 @@ class PhangoField {
public $update=0;
/**
* A property for set if error
*/
public $error=0;
/**
* Method used for internal tasks related with searchs. You can overwrite this method in your PhangoField object if you need translate the value that the user want search to a real value into the database.
@ -178,6 +183,17 @@ class PhangoField {
}
/**
* Basic check for sql things
*/
public function check($value)
{
return str_replace('"', '"', $value);
}
/**
* Method for create a form, you only need subclass the field if you want another form different to default
*/

View file

@ -2,7 +2,7 @@
namespace PhangoApp\PhaModels;
if(!function_exists('mysql_query'))
if(!function_exists('mysqli_query'))
{
throw new \Exception('Error: Mysql database don\'t supported by php');

View file

@ -320,6 +320,8 @@ class ModelForm {
$post[$key_form]=$form->field->check($post[$key_form]);
//If isset how false the error field..., then error.
if($post[$key_form]=='' && $form->required==1)
{