Hi,

   I have a form to add users to my database.

I want the Doctornumber(id) & subdomain to be unique( no duplicates)

I tried the following

http://bakery.cakephp.org/articles/view/checking-for-duplicate-records-unique-record

the add user function has the following code


if (!empty($this->data))
      {

        if ($this->User->isUnique('id', $this->data['User']['id']) &&
$this->User->isUnique('subdom', $this->data['User']['subdom']))
        {
             if ($this->User->save($this->data))
                {
                $this->flash('Doctor has been saved.','/users/
adddoctor');
                }
        }
}

and my view files has this

<label for="spec">Subdomain Name:</label>
          <p>
        <?php echo $html->input('User/subdom', array('size' => '40'))?
>
       <font color="red"> <?php echo $html->tagErrorMsg('User/subdom',
'Subdomain is required.') ?></font>
      <font color="red"> <?php echo $html->tagErrorMsg('User/
unique_subdom', 'Enter another subdomain, this is already used.'); ?></
font>
                </p>

                 <label for="spec">Doctor Number:</label>
          <p>
        <?php echo $html->input('User/id', array('size' => '40'))?>
       <font color="red"> <?php echo $html->tagErrorMsg('User/id',
'Doctor Number is required.') ?></font>
      <font color="red"> <?php echo $html->tagErrorMsg('User/
unique_id', 'Enter another number, this is already used.'); ?></font>


the problem is when any of the fields is wrong it always says "Enter
another number, this is already used"

even if the subdomain field is wrong the result is "Enter another
number, this is already used"


what would be the problem? Can't i do multiple field validations?

Please Help me

Thank you

Isaac Raja


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to