Re: Data validation doesn't work when on live server
1) You're probably running CentOS on your production server. 2) CentOS ships with broken PCRE UTF-8 libraries. 3) A few of the validation rules in CakePHP use multibyte flags (e.g. for alphanumeric validation) Combine the above, and you get the problem you've described. Solutions: 1) Ditch CentOS. It's a piece of shit for PHP web development. It ships with PHP 5.1.6 (4 years old), an ancient version of Apache, OpenSSL 3.x (which is currently at a 5.x release), and more. Using CentOS is just going to cause pain and trouble. 2) Stick with the shit that is CentOS, and fix the RPMs: http://gaarai.com/2009/01/31/unicode-support-on-centos-52-with-php-and-pcre/ 3) Write your own custom validation rules for any built-in rules that use multibyte flags in the regular expressions. There aren't really any other options. -jperras On Feb 17, 3:43 pm, Atti moltoespeci...@googlemail.com wrote: Hi all, Just a quick question, I managed to get my data validation working perfectly on my local apache (XAMPP) web server, but as soon as I uploaded the site to the internet the validation flag seems to be always true, ie, there is not validation going on, so it seems. What settings on my live server would allow this to happen, the page im talking about is:http://www.findworkabroad.com/signup any help grately appreciated Thanks Atti Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Data validation doesn't work when on live server
Model: class Registration extends AppModel { var $name = 'Registration'; var $validate = array( 'name' = array( 'rule' = array('minLength', 5), 'required' = true, 'message' = 'Please enter your full namebr/' ), 'email' = array( 'rule' = array('email'), 'message' = 'Please supply a valid email address.' ), 'password' = array( 'rule' =array('minLength', 5), 'required' = true, 'message' = 'Your password must be longer than 5 characters' ), 'tel' = array( 'rule' = array('phone', /((\+44\s?\(0\)\s?\d{2,4})|(\+44\s? (01|02|03|07|08)\d{2,3})|(\+44\s?(1|2|3|7|8)\d{2,3})|(\(\+44\)\s? \d{3,4})|(\(\d{5}\))|((01|02|03|07|08)\d{2,3})|(\d{5}))(\s|-|.) (((\d{3,4})(\s|-)(\d{3,4}))|((\d{6,7})))/, null), 'required' = true, 'message' = 'Please enter a correct UK number' ), 'mobile' = array( 'rule' = array('phone', /((\+44\s?\(0\)\s?\d{2,4})|(\+44\s? (01|02|03|07|08)\d{2,3})|(\+44\s?(1|2|3|7|8)\d{2,3})|(\(\+44\)\s? \d{3,4})|(\(\d{5}\))|((01|02|03|07|08)\d{2,3})|(\d{5}))(\s|-|.) (((\d{3,4})(\s|-)(\d{3,4}))|((\d{6,7})))/, null), 'message' = 'Please enter a correct UK mobile number' ), 'add1' = array( 'rule' =array('minLength', 5), 'required' = true, 'message' = 'You must enter the first line of your address' ), 'postcode' = array( 'rule' =array('minLength', 3), 'required' = true, 'message' = 'You must enter your postcode' ), ); } controller: App::import('Sanitize'); class RegistrationsController extends AppController { var $name = 'Registrations'; var $helpers = array('Form'); var $components = array('Email'); function signup() { $this-pageTitle = 'Find Work Abroad:Sign up for free online today - Guaranteed work TEFL Teaching english in southern China, Guaranteed job and placement, EFL, ESL Teach English in China'; $validates = true; $saved = true; $alldone = false; $message = ; if(isset($_GET['year'])) { $this-set('year', Sanitize::paranoid($_GET['year'])); } else if(isset($_POST['signupYear'])) { $this-set('year', Sanitize::paranoid($_POST['signupYear'])); } else { $this-set('year','2010'); } if(isset($this-data['Registration']['name'])) { $this-set(registration, $this-data); $this-Registration-set($this-data); if($this-data['Registration']['password']!=$this- data['Registration']['password2']) { $this-Registration-invalidate('password2', 'Your passwords must match'); } if ($this-Registration-validates()) { //check we dont have that email already if(($this-Registration-find('count', array('conditions' = array('Registration.email' = $this-data['Registration'] ['email']==0) { $this-data['Registration']['address'] = $this- data['Registration']['add1']. .$this-data['Registration'] ['add2']; $this-data['Registration']['password'] = md5($this- data['Registration']['password']); $this-data['Registration']['signupdate'] = date('l jS \of F Y h:i:s A'); if
Re: Data validation doesn't work when on live server
I have instructed my host to upgrade the software on the server as I dont have control over it. On Feb 18, 10:36 am, jperras joel.per...@gmail.com wrote: 1) You're probably running CentOS on your production server. 2) CentOS ships with broken PCRE UTF-8 libraries. 3) A few of the validation rules in CakePHP use multibyte flags (e.g. for alphanumeric validation) Combine the above, and you get the problem you've described. Solutions: 1) Ditch CentOS. It's a piece of shit for PHP web development. It ships with PHP 5.1.6 (4 years old), an ancient version of Apache, OpenSSL 3.x (which is currently at a 5.x release), and more. Using CentOS is just going to cause pain and trouble. 2) Stick with the shit that is CentOS, and fix the RPMs:http://gaarai.com/2009/01/31/unicode-support-on-centos-52-with-php-an... 3) Write your own custom validation rules for any built-in rules that use multibyte flags in the regular expressions. There aren't really any other options. -jperras On Feb 17, 3:43 pm, Atti moltoespeci...@googlemail.com wrote: Hi all, Just a quick question, I managed to get my data validation working perfectly on my local apache (XAMPP) web server, but as soon as I uploaded the site to the internet the validation flag seems to be always true, ie, there is not validation going on, so it seems. What settings on my live server would allow this to happen, the page im talking about is:http://www.findworkabroad.com/signup any help grately appreciated Thanks Atti Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Data validation doesn't work when on live server
Hi all, Just a quick question, I managed to get my data validation working perfectly on my local apache (XAMPP) web server, but as soon as I uploaded the site to the internet the validation flag seems to be always true, ie, there is not validation going on, so it seems. What settings on my live server would allow this to happen, the page im talking about is: http://www.findworkabroad.com/signup any help grately appreciated Thanks Atti Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Data validation doesn't work when on live server
Can you post your model and your controller action? On Feb 18, 3:43 am, Atti moltoespeci...@googlemail.com wrote: Hi all, Just a quick question, I managed to get my data validation working perfectly on my local apache (XAMPP) web server, but as soon as I uploaded the site to the internet the validation flag seems to be always true, ie, there is not validation going on, so it seems. What settings on my live server would allow this to happen, the page im talking about is:http://www.findworkabroad.com/signup any help grately appreciated Thanks Atti Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Data validation doesn't work
Finally its working now Thanks guys for all the help.. I just changes the 'user' in the form create to 'User' and now everythings working fine. On Jan 9, 12:01 pm, josnidhin josnid...@gmail.com wrote: I tried this still not working..If I use scaffolding to test everything works fine validation errors shows up. When I use my view then the problem arises. On Jan 8, 2:29 pm, Nature Lover nature_lover1...@yahoo.co.in wrote: Hi! try by mentioning also the model name while outputting errors, so the view code will become: ?echo $form-create('user', array('action' = 'signup'));? fieldset legendSignup/legend ?php echo $form-input('User.users_name',array (label=Name:)); echo $form-error('User.users_name'); echo $form-input('User.users_email',array (label=Email:)); echo $form-error('User.users_email'); echo $form-input('User.users_password',array (label=Password:,type=password)); echo $form-input('User.password_confirm',array ('label'='Password Confirm:','type'='password')); echo $form-error('User.users_password'); echo $form-error('User.password_confirm'); ? /fieldset ?echo $form-end(Sign Up);? Thanks! On Jan 8, 10:34 am,josnidhinjosnid...@gmail.com wrote: ?echo $form-create('user', array('action' = 'signup'));? fieldset legendSignup/legend ?php echo $form-input('users_name',array(label=Name:)); echo $form-error('users_name'); echo $form-input('users_email',array(label=Email:)); echo $form-error('users_email'); echo $form-input('users_password',array (label=Password:,type=password)); echo $form-input('password_confirm',array('label'='Password Confirm:','type'='password')); echo $form-error('users_password'); echo $form-error('password_confirm'); ? /fieldset ?echo $form-end(Sign Up);? This is how my view looks like. I am still not getting the errors. But my validation is working as it only inserts into the database when the data is correct. var $validate = array( users_name = array(rule = alphaNumeric,required = true,allowEmpty=false,message = Alphabets and numbers only), users_email = array( email=array(rule=email,message=Invalid email address,required = true,allowEmpty=false), unique=array(rule=array (validateUniqueEmail),message=This Email is already in use,required = true,allowEmpty=false)), users_password = array(rule = array (confirmPassword,password),required=true,allowEmpty=false,message = Password do not match), password_confirm = array(rule = alphaNumeric,required = true) ); This is how my validate array in model looks like confirmPassword and validateUniqueEmail are function that I wrote. I am not able to figure out why this is happening. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Data validation doesn't work
I tried this still not working..If I use scaffolding to test everything works fine validation errors shows up. When I use my view then the problem arises. On Jan 8, 2:29 pm, Nature Lover nature_lover1...@yahoo.co.in wrote: Hi! try by mentioning also the model name while outputting errors, so the view code will become: ?echo $form-create('user', array('action' = 'signup'));? fieldset legendSignup/legend ?php echo $form-input('User.users_name',array (label=Name:)); echo $form-error('User.users_name'); echo $form-input('User.users_email',array (label=Email:)); echo $form-error('User.users_email'); echo $form-input('User.users_password',array (label=Password:,type=password)); echo $form-input('User.password_confirm',array ('label'='Password Confirm:','type'='password')); echo $form-error('User.users_password'); echo $form-error('User.password_confirm'); ? /fieldset ?echo $form-end(Sign Up);? Thanks! On Jan 8, 10:34 am,josnidhinjosnid...@gmail.com wrote: ?echo $form-create('user', array('action' = 'signup'));? fieldset legendSignup/legend ?php echo $form-input('users_name',array(label=Name:)); echo $form-error('users_name'); echo $form-input('users_email',array(label=Email:)); echo $form-error('users_email'); echo $form-input('users_password',array (label=Password:,type=password)); echo $form-input('password_confirm',array('label'='Password Confirm:','type'='password')); echo $form-error('users_password'); echo $form-error('password_confirm'); ? /fieldset ?echo $form-end(Sign Up);? This is how my view looks like. I am still not getting the errors. But my validation is working as it only inserts into the database when the data is correct. var $validate = array( users_name = array(rule = alphaNumeric,required = true,allowEmpty=false,message = Alphabets and numbers only), users_email = array( email=array(rule=email,message=Invalid email address,required = true,allowEmpty=false), unique=array(rule=array (validateUniqueEmail),message=This Email is already in use,required = true,allowEmpty=false)), users_password = array(rule = array (confirmPassword,password),required=true,allowEmpty=false,message = Password do not match), password_confirm = array(rule = alphaNumeric,required = true) ); This is how my validate array in model looks like confirmPassword and validateUniqueEmail are function that I wrote. I am not able to figure out why this is happening. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Data validation doesn't work
Hi gearvOsh, Unfortunately nothing happens again :( I tryed with both options (required = true and notEmpty rule) and nothing happens. More tips? Thanks! On 29 dez 2008, 23:24, gearvOsh mileswjohn...@gmail.com wrote: You either need to have: required = true Or use the notEmpty rule. http://book.cakephp.org/view/127/One-Rule-Per-Fieldhttp://book.cakephp.org/view/740/notEmpty --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Data validation doesn't work
Hi gearvOsh, Unfortunately nothing happens again :( I tryed with both options (required = true and notEmpty rule) and nothing happens. More tips? Thanks! On 29 dez 2008, 23:24, gearvOsh mileswjohn...@gmail.com wrote: You either need to have: required = true Or use the notEmpty rule. http://book.cakephp.org/view/127/One-Rule-Per-Fieldhttp://book.cakephp.org/view/740/notEmpty --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Data validation doesn't work
Hi guys, I'm trying to use data validation on my model but I don't find where is my error. When I leave a form field empty, nothing happens (no message erros). But when fill all fields, all data is saved to database. Any skilled guy could help me? Below are some pieces of my code. If you need any detail, please let me know. View code: ?php echo $form-create('Property'); echo $form-input('oferta_imovel', array( 'label' = 'Imóvel para:', 'options' = array('1'='Locacao', '2'='Venda'), 'empty' = ' Escolha')); echo $form-input('tipo_imovel', array( 'label' = 'Seu imóvel é:', 'options' = array('1'='Casa', '2'='Apartamento'), 'empty' = ' Escolha')); echo $form-input('endereco_imovel', array( 'label' = 'Endereço:', 'rows' = '3')); echo $form-input('bairro_imovel', array( 'label' = 'Bairro:')); echo $form-input('cidade_imovel', array( 'label' = 'Cidade:')); echo $form-input('valor_imovel', array( 'label' = 'Valor:')); echo $form-input('estado_imovel', array( 'label' = 'Estado:', 'options' = array('sp'='SP', 'rj'='RJ'), 'empty' = ' Escolha:')); echo $form-end('Enviar'); ? Model code: var $validate = array( 'tipo_imovel' = array( 'rule' = array('minLength', 1), 'message' = 'Selecione o tipo do imóvel' ), 'oferta_imovel' = array( 'rule' = array('minLength', 1), 'message' = 'Selecione a oferta de imóvel' ), 'endereco_imovel' = array( 'rule' = array('minLength', 1), 'message' = 'É necessário preencher o endereço' ), 'bairro_imovel' = array( 'rule' = array('minLength', 1), 'required' = true, 'message' = 'É necessário preencher o bairro' ), 'cidade_imovel' = array( 'rule' = array('minLength', 1), 'message' = 'É necessário preencher o cidade' ), 'estado_imovel' = array( 'rule' = array('minLength', 1), 'message' = 'É necessário preencher o estado' ), 'valor_imovel' = array( 'rule' = array('minLength', 1), 'message' = 'Preencha um valor válido' ) ); Controller method: function add() { if (!empty($this-data)) { if ($this-Property-save($this-data)) { $this-flash('Seu imovel foi adicionado com sucesso.', '/keizai/ properties'); } } } Thanks very much! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Data validation doesn't work
You either need to have: required = true Or use the notEmpty rule. http://book.cakephp.org/view/127/One-Rule-Per-Field http://book.cakephp.org/view/740/notEmpty --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---