sorry Chris,
you are absolutely correct.
I misunderstood what jonkee posted.
On Wed, May 14, 2008 at 9:06 PM, Chris Hartjes <[EMAIL PROTECTED]> wrote:
>
> On Wed, May 14, 2008 at 3:38 PM, Marc Schuetze <[EMAIL PROTECTED]> wrote:
>>
>> But the current behavior is not doing that. When a field is mi
On Wed, May 14, 2008 at 3:38 PM, Marc Schuetze <[EMAIL PROTECTED]> wrote:
>
> But the current behavior is not doing that. When a field is missing in
> a request it is not being picked up by the validation routine
Wasn't this question already answered in this thread? If your
validation rules requ
> But the current behavior is indeed correct. You simply cannot trust
> that values that should be set in your form will be. If you get a
> request that comes in missing a field, your validation routine needs
> to pick that up. Otherwise, you'd need to do an isset() for each
> required value after
> What if there was a case where you didn't want to save all of the
> fields again when you're updating a record?
There are a few ways to go, the easiest probably being
Model::saveField():
$this->User->id = 1
$this->User->saveField('username', 'new_username')
Or use some more complex validation
My understanding is that the controller should remove the field from
the validation array:
unset($this->ModelName->validate['field_name']);
On Wed, May 14, 2008 at 12:22 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> What if there was a case where you didn't want to save all of the
> field
What if there was a case where you didn't want to save all of the
fields again when you're updating a record?
For instance, if a user is updating his or her User record, and wants
to edit a username and birthdate, for example. You probably wouldn't
have a form field for 'password' in this same p
The alphaNumeric rule may not be enough if you want spaces, hyphens,
etc. to be accepted as well. If so, try 'rule' => array('minLength',
1) instead.
On Tue, Apr 29, 2008 at 3:36 PM, Marc Schuetze <[EMAIL PROTECTED]> wrote:
>
> ok I'll be sure to do that.
>
> thanks for your help
>
>
>
> On Tu
ok I'll be sure to do that.
thanks for your help
On Tue, Apr 29, 2008 at 8:28 PM, jonknee <[EMAIL PROTECTED]> wrote:
>
> On Apr 29, 3:13 pm, MarcS <[EMAIL PROTECTED]> wrote:
> > I don't think there's a bug in it.
> >
> > all I have is this
> >
> > var $validate = array(
> >
On Apr 29, 3:13 pm, MarcS <[EMAIL PROTECTED]> wrote:
> I don't think there's a bug in it.
>
> all I have is this
>
> var $validate = array(
> 'name' => VALID_NOT_EMPTY,
> 'url' => array('rule' => 'url','message' => 'this field must
> contain a valid url')
>
I don't think there's a bug in it.
all I have is this
var $validate = array(
'name' => VALID_NOT_EMPTY,
'url' => array('rule' => 'url','message' => 'this field must
contain
a valid url')
);
I had a bug in my script which caused both name and url
> well my thinking is, if you wanted a field validated, you would have a
> form field present for it, at which point it would pass this field
> along for validation
You should never trust your validation to the form values that should
be coming in from the user (you should never trust *anything*
yeah I can see that argument.
thanks for your replies
On Apr 29, 6:59 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> well my thinking is, if you wanted a field validated, you would have a
> form field present for it, at which point it would pass this field
> along for validation
>
> On Apr
> But it doesn't make much sense to me that cake will save records even
> though validation rules say that the field shouldn't be empty.
Again, you're not saving the invalid data, you're only saving the
valid data. Validation is about making sure data that's going to be
saved is correct accordin
well my thinking is, if you wanted a field validated, you would have a
form field present for it, at which point it would pass this field
along for validation
On Apr 29, 1:55 pm, MarcS <[EMAIL PROTECTED]> wrote:
> yeah I guess I'll have to do that.
> But it doesn't make much sense to me that cake
How does it not make sense to you? If you are not attempting to save
the data, why do you care if it's valid? Quite the contrary;
validating data I'm not trying to save wouldn't make much sense.
--~--~-~--~~~---~--~~
You received this message because you are subs
yeah I guess I'll have to do that.
But it doesn't make much sense to me that cake will save records even
though validation rules say that the field shouldn't be empty.
There ought to be an option which would force it to validate all
fields, including those that have not been passed.
On Apr 29, 6:
Cake only validates the fields you're passing to it, so since there is
no 'b' in your data save, it's not being validated
As far as I know it still works this way in 1.2; but I could be wrong;
try passing array('a'=>'food', 'b'=>'')
On Apr 29, 1:50 pm, MarcS <[EMAIL PROTECTED]> wrote:
> Hi,
>
>
Hi,
I'm wondering whether the following is desired behaviour or it is a
bug.
let's say a table has 2 columns a and b. B is required.
when I do
$this->Model->save('a' => 'foo');
the record validates even though a is required. It seems like fields
that are not included in the data passed to save()
18 matches
Mail list logo