Thursday, September 30, 2010

Re: CakePHP ignores notEmpty validation rule when the field's name is not a key in $data! (Bug or Feature?)

Thanks Euromark for your good hint. I certainly should read through
your blogs in the near future...

But do you know why CakePHP handles stuff this way? Looks very, very
unintuitive to me. With Ruby on Rails I had much better experiences
about stuff like this a few years ago (everything just seemed to work
the way I expected it although I didn't have much experience with it
then), and I'm sure today they even have progressed much farer...

It seems a bit sad to me that CakePHP clearly doesn't seem to be able
to come even close to the experience of RoR. Any yes, I know CakePHP
isn't RoR, and yes, I could switch (well actually, I can't)... Just my
2 c€nts...

On Thu, Sep 30, 2010 at 2:58 PM, euromark <dereuromark@googlemail.com> wrote:
> actually it is NOT a bug
> although many are not aware of that behavior :)
>
> you need to make sure that the field is passed to the validation
> otherwise it will be ignored
>
> @see http://www.dereuromark.de/2010/09/21/saving-model-data-and-security/
>
>
> On 30 Sep., 14:52, psybear83 <psybea...@gmail.com> wrote:
>> Hi everybody
>>
>> I have baked the following very straight-forward model:
>>
>> class Post extends AppModel {
>>         var $name = 'Post';
>>         var $displayField = 'name';
>>         var $validate = array(
>>                 'name' => array(
>>                         'notempty' => array(
>>                                 'rule' => array('notempty')
>>                         ),
>>                 ),
>>         );
>>
>> }
>>
>> It only needs a value for "name" to be saved.
>>
>> Now I've written the following 3 tests:
>>
>>   function testShouldNotBeValidWithEmptyName() {
>>     $this->Post->create(array('name' => ''));
>>     $this->assertFalse($this->Post->validates());
>>   }
>>
>>   function testShouldNotBeValidWithoutName() {
>>     $this->Post->create();
>>     $this->assertFalse($this->Post->validates()); // Fails!
>>   }
>>
>>   function testShouldNotBeValidWithNullName() {
>>     $this->Post->create(array('name' => null));
>>     $this->assertFalse($this->Post->validates());
>>   }
>>
>> I expect all three of them to work, but the 2nd one fails! So why does
>> it validate when there truly is no value for the "name" field? Is this
>> really the way it should be, or is it a bug?
>>
>> I'm on version 1.3.4.
>>
>> Thanks for help
>> Josh
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>
> 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 to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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 to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

opening a popup window when clicking on a link

hi everyone,

in my view I have a link:
echo $html->link('My
Favorites'...........);


now when a user clicks the link i want a popup window to open and show
data from the database with the ajax paginator. but how can i open a
new window as a popup??

looking forward to your feedback. thank you

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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 to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: CakePHP ignores notEmpty validation rule when the field's name is not a key in $data! (Bug or Feature?)

actually it is NOT a bug
although many are not aware of that behavior :)

you need to make sure that the field is passed to the validation
otherwise it will be ignored

@see http://www.dereuromark.de/2010/09/21/saving-model-data-and-security/


On 30 Sep., 14:52, psybear83 <psybea...@gmail.com> wrote:
> Hi everybody
>
> I have baked the following very straight-forward model:
>
> class Post extends AppModel {
>         var $name = 'Post';
>         var $displayField = 'name';
>         var $validate = array(
>                 'name' => array(
>                         'notempty' => array(
>                                 'rule' => array('notempty')
>                         ),
>                 ),
>         );
>
> }
>
> It only needs a value for "name" to be saved.
>
> Now I've written the following 3 tests:
>
>   function testShouldNotBeValidWithEmptyName() {
>     $this->Post->create(array('name' => ''));
>     $this->assertFalse($this->Post->validates());
>   }
>
>   function testShouldNotBeValidWithoutName() {
>     $this->Post->create();
>     $this->assertFalse($this->Post->validates()); // Fails!
>   }
>
>   function testShouldNotBeValidWithNullName() {
>     $this->Post->create(array('name' => null));
>     $this->assertFalse($this->Post->validates());
>   }
>
> I expect all three of them to work, but the 2nd one fails! So why does
> it validate when there truly is no value for the "name" field? Is this
> really the way it should be, or is it a bug?
>
> I'm on version 1.3.4.
>
> Thanks for help
> Josh

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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 to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

CakePHP ignores notEmpty validation rule when the field's name is not a key in $data! (Bug or Feature?)

Hi everybody

I have baked the following very straight-forward model:

class Post extends AppModel {
var $name = 'Post';
var $displayField = 'name';
var $validate = array(
'name' => array(
'notempty' => array(
'rule' => array('notempty')
),
),
);
}

It only needs a value for "name" to be saved.

Now I've written the following 3 tests:

function testShouldNotBeValidWithEmptyName() {
$this->Post->create(array('name' => ''));
$this->assertFalse($this->Post->validates());
}

function testShouldNotBeValidWithoutName() {
$this->Post->create();
$this->assertFalse($this->Post->validates()); // Fails!
}

function testShouldNotBeValidWithNullName() {
$this->Post->create(array('name' => null));
$this->assertFalse($this->Post->validates());
}

I expect all three of them to work, but the 2nd one fails! So why does
it validate when there truly is no value for the "name" field? Is this
really the way it should be, or is it a bug?

I'm on version 1.3.4.

Thanks for help
Josh

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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 to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: Prev/Next Record

There's probably a way to use pagination with the limit set to 1?

Jeremy Burns
Class Outfit

jeremyburns@classoutfit.com
http://www.classoutfit.com

On 30 Sep 2010, at 02:09, naidim wrote:

> For viewing a record, how would one get the record id for the next and
> previous records in order to create Next/Previous links?
>
> Thanks
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>
> 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 to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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 to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: Session destroyed by changing domain

Hi,

Maybe this help you: http://www.daniweb.com/forums/thread180252.html

On Thu, Sep 30, 2010 at 10:42 AM, michel <michelgrin@gmail.com> wrote:
Hello,

First lets me explain my situation. I have three domains with one
site. When I change from domain my login session will be destroyed.

When I login, close my browser and open it again. My session is
available. Of course not a few hours later.

How is it possible, that I can use one session on three domains? Or
when that is not possible ... that my first session will not be
destroyed when I came back.

Thank you very much! And sorry for my very bad English.

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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 to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en



--
Vivi
http://photos.vr-3d.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
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 to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: Session destroyed by changing domain

and why again are you using 3 domains for one single site?
nobody does that - at least not with a very good reason :)

On 30 Sep., 09:42, michel <michelg...@gmail.com> wrote:
> Hello,
>
> First lets me explain my situation. I have three domains with one
> site. When I change from domain my login session will be destroyed.
>
> When I login, close my browser and open it again. My session is
> available. Of course not a few hours later.
>
> How is it possible, that I can use one session on three domains? Or
> when that is not possible ... that my first session will not be
> destroyed when I came back.
>
> Thank you very much! And sorry for my very bad English.

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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 to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en