Re: Problem with validation
I would suggest if you want good quality and helpful answers that you provide real code rather than theoretical references to ModelA and ModelB. I have tried reading the above and it seems a very confusing and odd setup which does not appear to be making logcial use of CakePHP's associations. If the two models are related then you would save through $this->ModelA->saveAll(); or $this->ModelA->ModelB->save(); Either way CakePHP will only validate ModelB if you have set a validation array and if you have it will always validate that model regardless of where the save call is made from, unless you tell the save call not to validate. HTH, Paul. On Jul 9, 4:11 pm, Brian Lin wrote: > I'm experiencing my controller validating data even though the model > has set a $validate array. > > I have two different controllers and models, A and B. > > So in controllerA, i have a $uses = modelB. > Also I have a viewA function that adds data into tableB using > $this->ModelB->saveAll($this->data) > > In modelB, I have a $validate table that corresponds with the > individual fields in the tableA/form. > Also in viewA, i have a form that is corresponds to the model of B. > However it always saves into tableB even when I put in bad data that > should not validate. > > Then I tried using the exact same code in controllerB and started > showing the individual validation messages for the form. > > Can anyone explain why this happens? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Problem with validation
I'm experiencing my controller validating data even though the model has set a $validate array. I have two different controllers and models, A and B. So in controllerA, i have a $uses = modelB. Also I have a viewA function that adds data into tableB using $this- >ModelB->saveAll($this->data) In modelB, I have a $validate table that corresponds with the individual fields in the tableA/form. Also in viewA, i have a form that is corresponds to the model of B. However it always saves into tableB even when I put in bad data that should not validate. Then I tried using the exact same code in controllerB and started showing the individual validation messages for the form. Can anyone explain why this happens? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: problem with validation
I changed if($this->Product->ProductVariant->Cart->save($this->data,true)) to if($this->Product->ProductVariant->Cart->save($this->data ['Product'],true)) and validation seems to be working but I don't get a message next to a quantity input field like I do elsewhere when validating form fields?! thanks On Nov 28, 7:40 pm, luigi7up <[EMAIL PROTECTED]> wrote: > I have following models: > > Product, ProductVariant, Cart > > Product (hasMany ProductVariants ) > ProductVariants (belongsTo Product & Cart) > Cart (hasMany ProductVariants) > > In my Product View action I have following form to add products to > Cart table with session_id as identifier of whoes products are in > cart: > > $form->create('Product',array > ('action'=>'addToCart','id'=>'add','class'=>'form')); > echo $form->input('quantity'); > echo $form->submit(); > echo $form->end(); > > There is also a Drop down menu in this form to choose a product > variant id (SEX and SIZE) but for sake of simplicity I'm gonna leave > it out. > > Now, first I had my "addToCart" action defined in cart_controloler but > then I moved it to Products::addToCart. > > I want to validate my field quantity that it is a numeric value and if > it's not I want error next to that input field. > > My Products::addToCart action looks like this: > > if($this->Product->ProductVariant->Cart->save($this->data,true)) > { > $this->Session->setFlash(__('Added to cart', > true)); > } > else > { > $this->Session->setFlash(__('Problem!', > true)); > } > $this->redirect(array('action'=>'view','id'=>$this->data['Product'] > ['product_id'])); > > No matter where I define my $validate variable (Cart or Product) my > validation doesn't throw an error ?!? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
problem with validation
I have following models: Product, ProductVariant, Cart Product (hasMany ProductVariants ) ProductVariants (belongsTo Product & Cart) Cart (hasMany ProductVariants) In my Product View action I have following form to add products to Cart table with session_id as identifier of whoes products are in cart: $form->create('Product',array ('action'=>'addToCart','id'=>'add','class'=>'form')); echo $form->input('quantity'); echo $form->submit(); echo $form->end(); There is also a Drop down menu in this form to choose a product variant id (SEX and SIZE) but for sake of simplicity I'm gonna leave it out. Now, first I had my "addToCart" action defined in cart_controloler but then I moved it to Products::addToCart. I want to validate my field quantity that it is a numeric value and if it's not I want error next to that input field. My Products::addToCart action looks like this: if($this->Product->ProductVariant->Cart->save($this->data,true)) { $this->Session->setFlash(__('Added to cart', true)); } else { $this->Session->setFlash(__('Problem!', true)); } $this->redirect(array('action'=>'view','id'=>$this->data['Product'] ['product_id'])); No matter where I define my $validate variable (Cart or Product) my validation doesn't throw an error ?!? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
problem with validation and auth
hi, i have problem, cus, after update to rc3, validation and auth modules just died - when im "authing" account, im logged with not exists account, validation not worked on at all .. i baked few applications on cake in same way, and it all worked before, until update to rc3, i dont know what is going wrong .. any one had a similar problem ? any solution? regards, mike --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Weird problem with validation, bug?
You should use add a field i.e 'change_password' to the model's validation array. You can then use the Security::hash to hash that value for saving in the action. http://www.littlehart.net/atthekeyboard/2008/01/22/simple-user-registration-in-cakephp-12-part-ii/ should help you somewhat. The article refers specifically to confirming passwords but the premise is the same. You need to grab the new password and the old. Check if the old is correct, if it is hash the new, move it to the data array and save the appropriate model. On Apr 8, 12:08 pm, Sebastian Veggiani <[EMAIL PROTECTED]> wrote: > Does anyone have any idea? > > On 7 abr, 20:25, elHobbit <[EMAIL PROTECTED]> wrote: > > > Thanks b logica. > > > But, I really need to use the validation rules in the User model. > > I'll try to overwrite the validation rules for the fields I'm not > > using in this view. > > Anyway, I think the problem isn't that, because with different fields > > the form works ok. > > > Again, thanks for your help. :) > > > On Apr 7, 7:31 pm, "b logica" <[EMAIL PROTECTED]> wrote: > > > > If the problem is that Cake is trying to validate User when > > > unnecessary you could try what Dardo just suggested for a similar > > > problem I was having. Put this in your edit() action: > > > > $this->User->validate = array(); > > > > On Mon, Apr 7, 2008 at 4:42 PM, elHobbit <[EMAIL PROTECTED]> wrote: > > > > > First, excuse me for my poor english. > > > > > I'm using Cake 1.2.6311. I'm having a weird problem validating some > > > > fields from my model. > > > > > The situation is like that: > > > > > - One model "users" with validation rules. > > > > - "Users" controller with 2 basic actions: 'edit' & 'changepassword'. > > > > - The problem: in the action "changepassword" where I'm only showing > > > > the field "password" (and hidden ID field) when the form is submited > > > > I'm obtaining a connection reset. > > > > > The weird thing is: > > > > > - If I add this two lines, in which I set the value for the "email" > > > > into the ['data'] array the forms submits OK and the validation is > > > > triggered. > > > > -- > > > > $pp = $this->User->read( null, $id ); > > > > $this->data['User']['email'] = $pp['User']['email']; > > > > -- > > > > > - If the only showed field is "email" the form is submited OK and the > > > > validation triggered as expected without manually loading the > > > > "password" field to the "data" array. So I guess this is not a problem > > > > related with some requirement of having all "validated" fields in the > > > > form. > > > > > My question is: > > > > Why if I only show the "email" field everything works fine. But with > > > > the field "password" I've to use the workaround from above? > > > > I'm very new with Cake so is VERY POSSIBLE I'm doing something vry > > > > wrong. > > > > > Someone can help me with this issue? Thanks for your attention. > > > > > PS: here is the code of my files: > > > > > User Model: > > > > > > > > - > > > > > > > class User extends AppModel{ > > > > > var $name = 'User'; > > > > var $belongsTo = array( 'Company', 'Group' ); > > > > > var $validate = array( > > > > > 'email' => array( > > > > 'required' => array( > > > > 'rule' => 'email', > > > > 'required' => true, > > > > 'message' => 'Ingrese una dirección de > > > > e-mail válida' > > > > ) > > > > ), > > > > > 'password' => array( > > > > 'required' => array( > > > > 'rule' => VALID_NOT_EMPTY, > > > > 'message' => 'Debe indicar su > > > > contraseña' > > > > ) > > > > ), > > > > > 'company_id' => array( > > > > 'required' => array( > > > > 'rule' => VALID_NOT_EMPTY, > > > > 'message' => 'Seleccione una empresa' > > > > ) > > > > ), > > > > > 'group_id' => array( > > > > 'required' => array( > > > > 'rule' => VALID_NOT_EMPTY, > > > > 'message' => 'Seleccione el grupo al > > > > que pertenece el usuario' > > > > ) > > > > ), > > > > > // campo adicional para confirmar la contraseña, no > > > > existe en la > > > > BBDD > > > > 'password_conf' => array( > > > > 'required' => array( > > > >
Re: Weird problem with validation, bug?
Does anyone have any idea? On 7 abr, 20:25, elHobbit <[EMAIL PROTECTED]> wrote: > Thanks b logica. > > But, I really need to use the validation rules in the User model. > I'll try to overwrite the validation rules for the fields I'm not > using in this view. > Anyway, I think the problem isn't that, because with different fields > the form works ok. > > Again, thanks for your help. :) > > On Apr 7, 7:31 pm, "b logica" <[EMAIL PROTECTED]> wrote: > > > If the problem is that Cake is trying to validate User when > > unnecessary you could try what Dardo just suggested for a similar > > problem I was having. Put this in your edit() action: > > > $this->User->validate = array(); > > > On Mon, Apr 7, 2008 at 4:42 PM, elHobbit <[EMAIL PROTECTED]> wrote: > > > > First, excuse me for my poor english. > > > > I'm using Cake 1.2.6311. I'm having a weird problem validating some > > > fields from my model. > > > > The situation is like that: > > > > - One model "users" with validation rules. > > > - "Users" controller with 2 basic actions: 'edit' & 'changepassword'. > > > - The problem: in the action "changepassword" where I'm only showing > > > the field "password" (and hidden ID field) when the form is submited > > > I'm obtaining a connection reset. > > > > The weird thing is: > > > > - If I add this two lines, in which I set the value for the "email" > > > into the ['data'] array the forms submits OK and the validation is > > > triggered. > > > -- > > > $pp = $this->User->read( null, $id ); > > > $this->data['User']['email'] = $pp['User']['email']; > > > -- > > > > - If the only showed field is "email" the form is submited OK and the > > > validation triggered as expected without manually loading the > > > "password" field to the "data" array. So I guess this is not a problem > > > related with some requirement of having all "validated" fields in the > > > form. > > > > My question is: > > > Why if I only show the "email" field everything works fine. But with > > > the field "password" I've to use the workaround from above? > > > I'm very new with Cake so is VERY POSSIBLE I'm doing something vry > > > wrong. > > > > Someone can help me with this issue? Thanks for your attention. > > > > PS: here is the code of my files: > > > > User Model: > > > > > > - > > > > > class User extends AppModel{ > > > > var $name = 'User'; > > > var $belongsTo = array( 'Company', 'Group' ); > > > > var $validate = array( > > > > 'email' => array( > > > 'required' => array( > > > 'rule' => 'email', > > > 'required' => true, > > > 'message' => 'Ingrese una dirección de > > > e-mail válida' > > > ) > > > ), > > > > 'password' => array( > > > 'required' => array( > > > 'rule' => VALID_NOT_EMPTY, > > > 'message' => 'Debe indicar su contraseña' > > > ) > > > ), > > > > 'company_id' => array( > > > 'required' => array( > > > 'rule' => VALID_NOT_EMPTY, > > > 'message' => 'Seleccione una empresa' > > > ) > > > ), > > > > 'group_id' => array( > > > 'required' => array( > > > 'rule' => VALID_NOT_EMPTY, > > > 'message' => 'Seleccione el grupo al que > > > pertenece el usuario' > > > ) > > > ), > > > > // campo adicional para confirmar la contraseña, no > > > existe en la > > > BBDD > > > 'password_conf' => array( > > > 'required' => array( > > > 'rule' => VALID_NOT_EMPTY, > > > 'message' => 'Debe confirmar su > > > contraseña' > > > ) > > > ) > > > > ); > > > > } > > > ?> > > > > Users controller > > > > > > - > > > > > > class UsersController extends AppController{ > > > > var $name = 'Users'; > > > var $paginate = array( 'limit' => 15, 'page' => 1 ); > > > > function control_view() { > > > .. > > > } > > > > function control_edit( $id = null ) { > > > // protección por tipo de admin > > > > // inicialización > > > $this
Re: Weird problem with validation, bug?
Thanks b logica. But, I really need to use the validation rules in the User model. I'll try to overwrite the validation rules for the fields I'm not using in this view. Anyway, I think the problem isn't that, because with different fields the form works ok. Again, thanks for your help. :) On Apr 7, 7:31 pm, "b logica" <[EMAIL PROTECTED]> wrote: > If the problem is that Cake is trying to validate User when > unnecessary you could try what Dardo just suggested for a similar > problem I was having. Put this in your edit() action: > > $this->User->validate = array(); > > On Mon, Apr 7, 2008 at 4:42 PM, elHobbit <[EMAIL PROTECTED]> wrote: > > > First, excuse me for my poor english. > > > I'm using Cake 1.2.6311. I'm having a weird problem validating some > > fields from my model. > > > The situation is like that: > > > - One model "users" with validation rules. > > - "Users" controller with 2 basic actions: 'edit' & 'changepassword'. > > - The problem: in the action "changepassword" where I'm only showing > > the field "password" (and hidden ID field) when the form is submited > > I'm obtaining a connection reset. > > > The weird thing is: > > > - If I add this two lines, in which I set the value for the "email" > > into the ['data'] array the forms submits OK and the validation is > > triggered. > > -- > > $pp = $this->User->read( null, $id ); > > $this->data['User']['email'] = $pp['User']['email']; > > -- > > > - If the only showed field is "email" the form is submited OK and the > > validation triggered as expected without manually loading the > > "password" field to the "data" array. So I guess this is not a problem > > related with some requirement of having all "validated" fields in the > > form. > > > My question is: > > Why if I only show the "email" field everything works fine. But with > > the field "password" I've to use the workaround from above? > > I'm very new with Cake so is VERY POSSIBLE I'm doing something vry > > wrong. > > > Someone can help me with this issue? Thanks for your attention. > > > PS: here is the code of my files: > > > User Model: > > > > - > > > class User extends AppModel{ > > > var $name = 'User'; > > var $belongsTo = array( 'Company', 'Group' ); > > > var $validate = array( > > > 'email' => array( > > 'required' => array( > > 'rule' => 'email', > > 'required' => true, > > 'message' => 'Ingrese una dirección de > > e-mail válida' > > ) > > ), > > > 'password' => array( > > 'required' => array( > > 'rule' => VALID_NOT_EMPTY, > > 'message' => 'Debe indicar su contraseña' > > ) > > ), > > > 'company_id' => array( > > 'required' => array( > > 'rule' => VALID_NOT_EMPTY, > > 'message' => 'Seleccione una empresa' > > ) > > ), > > > 'group_id' => array( > > 'required' => array( > > 'rule' => VALID_NOT_EMPTY, > > 'message' => 'Seleccione el grupo al que > > pertenece el usuario' > > ) > > ), > > > // campo adicional para confirmar la contraseña, no existe > > en la > > BBDD > > 'password_conf' => array( > > 'required' => array( > > 'rule' => VALID_NOT_EMPTY, > > 'message' => 'Debe confirmar su contraseña' > > ) > > ) > > > ); > > > } > > ?> > > > Users controller > > > > - > > > > class UsersController extends AppController{ > > > var $name = 'Users'; > > var $paginate = array( 'limit' => 15, 'page' => 1 ); > > > function control_view() { > > .. > > } > > > function control_edit( $id = null ) { > > // protección por tipo de admin > > > // inicialización > > $this->layout = 'default'; > > > // datos necesarios > > $companies = $this->User->Company->find( 'list' ); > > $this->set('companies', $companies ); > > > $groups = $this->User->Group->find( 'list' ); > > $this->set('group
Re: Weird problem with validation, bug?
If the problem is that Cake is trying to validate User when unnecessary you could try what Dardo just suggested for a similar problem I was having. Put this in your edit() action: $this->User->validate = array(); On Mon, Apr 7, 2008 at 4:42 PM, elHobbit <[EMAIL PROTECTED]> wrote: > > First, excuse me for my poor english. > > I'm using Cake 1.2.6311. I'm having a weird problem validating some > fields from my model. > > The situation is like that: > > - One model "users" with validation rules. > - "Users" controller with 2 basic actions: 'edit' & 'changepassword'. > - The problem: in the action "changepassword" where I'm only showing > the field "password" (and hidden ID field) when the form is submited > I'm obtaining a connection reset. > > The weird thing is: > > - If I add this two lines, in which I set the value for the "email" > into the ['data'] array the forms submits OK and the validation is > triggered. > -- > $pp = $this->User->read( null, $id ); > $this->data['User']['email'] = $pp['User']['email']; > -- > > - If the only showed field is "email" the form is submited OK and the > validation triggered as expected without manually loading the > "password" field to the "data" array. So I guess this is not a problem > related with some requirement of having all "validated" fields in the > form. > > > My question is: > Why if I only show the "email" field everything works fine. But with > the field "password" I've to use the workaround from above? > I'm very new with Cake so is VERY POSSIBLE I'm doing something vry > wrong. > > Someone can help me with this issue? Thanks for your attention. > > PS: here is the code of my files: > > User Model: > > - >class User extends AppModel{ > > var $name = 'User'; > var $belongsTo = array( 'Company', 'Group' ); > > var $validate = array( > > 'email' => array( > 'required' => array( > 'rule' => 'email', > 'required' => true, > 'message' => 'Ingrese una dirección de e-mail > válida' > ) > ), > > 'password' => array( > 'required' => array( > 'rule' => VALID_NOT_EMPTY, > 'message' => 'Debe indicar su contraseña' > ) > ), > > 'company_id' => array( > 'required' => array( > 'rule' => VALID_NOT_EMPTY, > 'message' => 'Seleccione una empresa' > ) > ), > > 'group_id' => array( > 'required' => array( > 'rule' => VALID_NOT_EMPTY, > 'message' => 'Seleccione el grupo al que > pertenece el usuario' > ) > ), > > // campo adicional para confirmar la contraseña, no existe en > la > BBDD > 'password_conf' => array( > 'required' => array( > 'rule' => VALID_NOT_EMPTY, > 'message' => 'Debe confirmar su contraseña' > ) > ) > > ); > > } > ?> > > Users controller > > - > > class UsersController extends AppController{ > > var $name = 'Users'; > var $paginate = array( 'limit' => 15, 'page' => 1 ); > > > function control_view() { > .. > } > > > function control_edit( $id = null ) { > // protección por tipo de admin > > // inicialización > $this->layout = 'default'; > > // datos necesarios > $companies = $this->User->Company->find( 'list' ); > $this->set('companies', $companies ); > > $groups = $this->User->Group->find( 'list' ); > $this->set('groups', $groups ); > > > // si no se ha enviado el formulario carga el ID del registro > a > editar > if ( empty( $this->data ) ) : > $this->User->id = $id; > $this->data = $this->User->read(); > else : > // si se ha enviado y valida guarda los datos > if ( $this->User->create($this->data) && $this->User- > >validates() ) : > > // encripta la contraseña si se está > ins
Weird problem with validation, bug?
First, excuse me for my poor english. I'm using Cake 1.2.6311. I'm having a weird problem validating some fields from my model. The situation is like that: - One model "users" with validation rules. - "Users" controller with 2 basic actions: 'edit' & 'changepassword'. - The problem: in the action "changepassword" where I'm only showing the field "password" (and hidden ID field) when the form is submited I'm obtaining a connection reset. The weird thing is: - If I add this two lines, in which I set the value for the "email" into the ['data'] array the forms submits OK and the validation is triggered. -- $pp = $this->User->read( null, $id ); $this->data['User']['email'] = $pp['User']['email']; -- - If the only showed field is "email" the form is submited OK and the validation triggered as expected without manually loading the "password" field to the "data" array. So I guess this is not a problem related with some requirement of having all "validated" fields in the form. My question is: Why if I only show the "email" field everything works fine. But with the field "password" I've to use the workaround from above? I'm very new with Cake so is VERY POSSIBLE I'm doing something vry wrong. Someone can help me with this issue? Thanks for your attention. PS: here is the code of my files: User Model: - array( 'required' => array( 'rule' => 'email', 'required' => true, 'message' => 'Ingrese una dirección de e-mail válida' ) ), 'password' => array( 'required' => array( 'rule' => VALID_NOT_EMPTY, 'message' => 'Debe indicar su contraseña' ) ), 'company_id' => array( 'required' => array( 'rule' => VALID_NOT_EMPTY, 'message' => 'Seleccione una empresa' ) ), 'group_id' => array( 'required' => array( 'rule' => VALID_NOT_EMPTY, 'message' => 'Seleccione el grupo al que pertenece el usuario' ) ), // campo adicional para confirmar la contraseña, no existe en la BBDD 'password_conf' => array( 'required' => array( 'rule' => VALID_NOT_EMPTY, 'message' => 'Debe confirmar su contraseña' ) ) ); } ?> Users controller - 15, 'page' => 1 ); function control_view() { .. } function control_edit( $id = null ) { // protección por tipo de admin // inicialización $this->layout = 'default'; // datos necesarios $companies = $this->User->Company->find( 'list' ); $this->set('companies', $companies ); $groups = $this->User->Group->find( 'list' ); $this->set('groups', $groups ); // si no se ha enviado el formulario carga el ID del registro a editar if ( empty( $this->data ) ) : $this->User->id = $id; $this->data = $this->User->read(); else : // si se ha enviado y valida guarda los datos if ( $this->User->create($this->data) && $this->User- >validates() ) : // encripta la contraseña si se está insertando if ( empty( $id ) ) : $this->data['User']['password'] = md5( $this->data['User'] ['password'] ); endif; if( $this->User->save( $this->data['User'] ) ) : $this->redirect('view'); endif; endif; endif; } function control_delete( $id = null ) { .. } function control_changepassword( $id = null ) { // protección por tipo de admin if ( $this->Session->read('Administrator.superadmin') != 1 ) : $this- >redirect('/control/'); endif; // inicialización $this->layout = '
Re: problem with validation
Well, if you don't do anything to remove it, the submitted form data ($this->data in your controller) will still be there when the form is displayed with validation errors. Which means the Project Name input field should be prepopulated with what the user just submitted. If you just want to get this value into your actual validation error message, then just have something like this in your view label('Project/name', 'Project Name');?> input('Project/name', array('size' => '60'));?> tagErrorMsg('Project/name', 'The Project Name `'. $html->tagValue('Project/name').'` is invalid - please use alphabetic characters only.');?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
problem with validation
Hai, I have one question with validation. I have an edit form that displays the details: Id: Project Name: Start date: End date: Project name must have validation ie; should be all alphbetic charecters. Validation has worked for me but i want the data that the user has entered in to the text box to be displayed there along with the error message. Can any one help me to solve the problem. Thanks, Vidya. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Problem with validation
Okay, now here's another issue with this validation. I've been trying to create an edit form with populated fields (with the data from the record being edited, of course). Now, when the form is submitted with an error, and that error is caught by the validation, all the populated fields return errors. This is because the value attribute for each form field is counting on the receiving data from the controller via $this->set('bla',$this->bla->read()). When a form error is generated, the view is rendered without the 'bla' array that the fields (among other things) depend on. I managed to get the validation working fine for my add page, because I wasn't trying to populate the fields. What's the best way to go about creating a populated edit page that can still handle validation? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Problem with validation
Feeling pretty stupid. Mispelled one of my validation functions, so it got run as a regular expression instead. It's all working now. Thanks though --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Problem with validation
You might want to make sure those constants are in caps. I.e.: VALID_EMAIL, VALID_NOT_EMPTY. If you're trying to do them in lowercase, PHP won't recognize them. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Problem with validation
BTW, I'm only using cake's predefined regex's (valid_not_empty, valid_email, etc...) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Problem with validation
I've been trying to implement the data validation scheme at http://wiki.cakephp.org/tutorials:advanced_validation, but I always seem to get this error: preg_match(): Delimiter must not be alphanumeric or backslash in C:\web\htdocs\cake\app\app_model.php on line 88. Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---