php - CakePHP validate fields that aren't in the Database -


i have form values aren't in database. wan't validation on them made validation rules using field names. somehow validation rules aren't being used.

i tried set different rules. file names correct since $hasmany connection works.

i hope can help!

form:

<?php   echo $this->form->create('map');     echo $this->form->input('min_x');     echo $this->form->input('max_x');     echo $this->form->input('min_y');     echo $this->form->input('max_y');   echo $this->form->end('submit'); ?> 

validation rules:

public $validate = array(   'min_x' => array(     'rule' => 'numeric',     'message' => 'please enter numeric value.'   ),   'max_x' => array(     'rule' => 'numeric',     'message' => 'please enter numeric value.'   ),   'min_y' => array(     'rule' => 'numeric',     'message' => 'please enter numeric value.'   ),   'max_y' => array(     'rule' => 'numeric',     'message' => 'please enter numeric value.'   ), ); 

rules validation case sensitive, so:

'rule' => 'numeric', 

should changed to

'rule' => 'numeric', 

for each instance.

you have comma on last field's array.


public $validate = array(   'min_x' => array(     'numeric' => array(         'rule' => 'numeric',         'message' => 'please enter numeric value.'     )   ),   'max_x' => array(     'numeric' => array(         'rule' => 'numeric',         'message' => 'please enter numeric value.'     )   ),   'min_y' => array(     'numeric' => array(         'rule' => 'numeric',         'message' => 'please enter numeric value.'     )   ),   'max_y' => array(     'numeric' => array(         'rule' => 'numeric',         'message' => 'please enter numeric value.'     )   ) ); 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -