In my User model, I have an identicalFields function that is used to
determine if 2 inputs have the exact same text or not. I am trying to
compare my Email and ConfirmEmail fields. When I call the function through
validation on my signup page, it works without any issue at all, however,
when I pass the same function through validation to my Edit function, it
returns an undefined index error:
<b>Notice</b> (8)</a>: Undefined index: User
[<b>APP/models/user.php</b>, line <b>103</b>
Here is the function in question:
98 function identicalFields( $field=array(), $compare_field=null
)
99 {
100 foreach( $field as $key => $value )
101 {
102 $vi = $value;
103 $v2 =
$this->data[$this->name][$compare_field];
104 if ($vi !== $v2)
105 {
106 return false;
107 }
108 else
109 {
110 continue;
111 }
112 }
113 return true;
114 }
and here is the validation from earlier in the model
62 'editemail' => array(
63 'email' => array(
64 'valid' => array(
65 'rule' => array('email',
true),
66 'message' => 'Please use a
valid E-mail address.'
67 ),
68 'checkUnique' => array(
69 'rule' =>
array('checkUnique', 'email'),
70 'message' => 'E-mail is
already being used. Choos
71 )
72 ),
73 'confirm_email' => array(
74 'valid' => array(
75 'rule' => array('email',
true),
76 'message' => 'Please use a
valid E-mail address!'
77 ),
78 'identical' => array(
79 'rule' =>
array('identicalFields', 'email'),
80 'message' => 'E-Mail
addresses must match'
81 )
82 )
83 )
I am using ValidationSets, with my validates function set as :
116 function validates($ruleset=null, $data=array())
117 {
118 $this->currentRuleSet =
(isset($ruleset))?$ruleset:$this->currentRuleSet;
119 $this->validate =
$this->validationSets[$this->currentRuleSet];
120 return parent::validates($data)?true:false;
121
122 }
and a print_r of the $this->data array produces:
Array
(
[User] => Array
(
[email] => [EMAIL PROTECTED]
[confirm_email] => [EMAIL PROTECTED]
)
)
I hope this is enough information!
--
In the name of Life, Liberty, and the pursuit of my sanity.
Siebren Bakker(Aevum Decessus)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---