if (!empty($a)); //I also tried isset, isset & !empty
Is the semi column here a typo ? If not this explains the origin of
your problem
On Dec 10, 10:29 am, Steveston <[EMAIL PROTECTED]> wrote:
> In view:
>
> <?php
> echo $html->input('User/username', array('id'=>'username',
> 'size'=>'50'));
> echo $html->tagErrorMsg('User/username', 'User name must
> unique and
> contain at least 5 and no more than 8 chars');
> ?>
> <div id="err">
> <?php
> echo $ajax->observeField('username', array('update'=>'err',
> 'url'=>"/users/checkduplicate", 'frequency'=>1));
> ?>
> </div>
>
> In controller:
>
> function checkduplicate()
> {
> $this->layout='ajax';
> $this->autoRender=false;
> $condition=array('username'=>$this->data['User']['username']);
> if (!empty($this->data['User']['username']))
> {
> $a=$this->User->find($condition);
> if (!empty($a)); //I also tried isset, isset & !empty
> echo $this->data['User']['username'].": Duplicate Entry";
> }
> }
>
> Whenever I enter some value in "username" text field, I always get the
> message that: xxxx :Duplicate Entry, even the entry does not exist in
> db.
>
> Why?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---