Good evening/morning,

I'm fairly new to cakePhp and partially succedd in setting up an HABTM
relationship between my user and profile table.

When I create a user, I can choose one or several profiles among the
available ones and when I save everything goes fine EXCEPT I couldn't
find out how to ensure at least one profile is selected.

In my user controller, I retrieve the profile list like this

$this->set('prof',$this->User->Profile->generateList('Profile.id
!=1','profile_name
ASC',null,'{n}.Profile.id','{n}.Profile.profile_name'

In my User_add view I have:

<?php echo $html->selectTag('Profile/Profile, $prof, $selected_prof,
array('multiple' => 'multiple'),null,false) ?>
<?php echo $html->tagErrorMsg('Profile/Profile, 'Please select a
profile.'); ?>

And finally in my User model I have
var $validate = array(
        'Profile'                       => VALID_NOT_EMPTY
}

But the problem is I never get this error message to be displaid. I
tried with several $validate values such as

var $validate = array(
        'Profile/Profile'                       => VALID_NOT_EMPTY
}

var $validate = array(
        'Profile/id'                    => VALID_NOT_EMPTY
}

None allow me to get the error message.

So my question is: would any of you has ever encountered this problem
and obviously how to solve it.

Many thanks.


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

Reply via email to