assuming you model is called User and you have all the validation
rules applied.
in your controller you need to specify
var $helpers = array('Html', 'Form');
This gives you access to the helpers in the view.
To create a form in the view
create('User' ,array('action' => 'add')); //this create
I have solved the first part of my question, but it seems that nobody
can answer my second question. How do I access that 'Profile must be
unique' message in my view? I can't find how to do it anywhere.
--~--~-~--~~~---~--~~
You received this message because you are
In 1.2 you can use Model::isUnique() method.
var $validate = array(
'username' => array(
'Username must be between 6 and 255 characters long.'
=> array(
'rule' => array('between', 6, 255),
That didn't work, it requires two arguements.
--~--~-~--~~~---~--~~
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
As you're using the 1.x branch, take this with a grain of salt because
I've never used it. I believe you can simply put:
$html->tagErrorMsg('User/profile')
If there's no error for 'User/profile' it won't display anything.
On Sun, Apr 20, 2008 at 10:04 PM, Chez17 <[EMAIL PROTECTED]> wrote:
>
>
Thanks for all your help. I have one last question. So now that I have
my validate working, how do I print the error message that I specify
in the function? Simon said that I don't need to put anything in the
view, but then says be sure to use the helper, can someone explain
what that means? How d
findByFirstName('foo')
On Sun, Apr 20, 2008 at 9:29 PM, Chez17 <[EMAIL PROTECTED]> wrote:
>
> Does the findBy() function work for any field? If I have a field like
> first_name how do you do the findBy() function?
>
> >
>
--~--~-~--~~~---~--~~
You received this
Does the findBy() function work for any field? If I have a field like
first_name how do you do the findBy() function?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email
Assuming you are using 1.2
I have created this snippet in the model. Could be but in app_model if
it is required.
//checks to see if the given fieldname is unique with the model
function checkUnique($data, $fieldName) {
$valid = false;
$this->recursive = -1;
Personally, I'd make those DEFAULT NULL, not the empty string.
Actually, I'd make most of them NOT NULL.
On Sun, Apr 20, 2008 at 12:02 PM, Joshua McFarren <[EMAIL PROTECTED]> wrote:
>
> Cake's validation will respect your DB.
>
> CREATE TABLE `users` (
> `id` int(11) unsigned NOT NULL auto_i
$result = $this->findByProfile();
On Sun, Apr 20, 2008 at 12:14 PM, Chez17 <[EMAIL PROTECTED]> wrote:
>
> b logica,
>
> You stop just short of the problem I need to solve. I dont know how to
> write the DuplicateProfile function. Thats the find() statement I need
> help with. I know cakes has
b logica,
You stop just short of the problem I need to solve. I dont know how to
write the DuplicateProfile function. Thats the find() statement I need
help with. I know cakes has the findByUsername function, I was asking
how to write something like that for the profile field.
Josh,
I tried doi
This may just be a typo in your post but you're using
$html->password() for a regular input. It should be
input('User/profile', array('size' => 20)); ?>
I can't give any pointers for Cake 1.x but if you upgrade to the 1.2x
branch you can do this:
create('User', array('action' => 'add'); ?>
input
Cake's validation will respect your DB.
CREATE TABLE `users` (
`id` int(11) unsigned NOT NULL auto_increment,
`username` varchar(255) NOT NULL default '',
`password` varchar(255) NOT NULL default '',
`email` varchar(255) NOT NULL default '',
`profile` varchar(255) NOT NULL default '',
I am having issues making sure that a field is unique. I am beginner
so please go easy on me. Right now, I am trying to create a simple
login system where the user name name and profile name have to be
unique. I have been cutting and pasting some stuff together and I
can't seem to get this to work
15 matches
Mail list logo