Hello,

I want to validate dynamic fields.

Normally validation is done by defining rules for a table field.
For example:

var $validate = array('Fieldname'  =>  some rules)

But I have defined my fields in this table:
Table: fields
id:int(6)
tab_id:int(4)
attribute:varchar(60)
type:varchar(10)
options:varchar(20)
selected:varchar(2)
position:smallint(4)
value:varchar(2)
checked:tinyint(1)
optional:tinyint(1)

And a few example inputs:
INSERT INTO `fields` VALUES (1, 1,'Name',NULL,NULL,NULL,1,NULL,NULL,
0);
INSERT INTO `fields` VALUES (12,3,'mit Aphasie','radio','ja, nein','2',
3,NULL,NULL,0);
INSERT INTO `fields` VALUES (42,3,'CheckboxTest','check','',NULL,4,'4',
1,1);

So I need to define a validation like that:

foreach (values_in_table as $value) {
  if ($value['optional'] == 0) {
    var $validate = array(
      $value['attribute']  =>  array(
         'rule'        =>  'alphaNumeric',
         'required'  =>  'true'
      )
    );
  }
}

I hope its clear what i mean.

Can I do this?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to