The cleanUpFields is the responsible of the date appearing as -- when you
are not setting a date. Normally it will construct something like 2007-12-31
(if today selected). I think you're using cake 1.1, so see [1], line 865,
for the source code of then Controller::cleanUpFields source code.
Regard
Here is the part of the form that deals with the obtained_date. Yes,
it is confusing as to why it would pass any value at all when the user
doesn't specify a date in the form. However, with the use of the
beforeSave() function, I have been able to unset the value.
labelTag('Skater/obta
What version of CakePHP are you using?
What does the edit.ctp/edit.thml look like?
On Dec 31, 2007 9:43 AM, Robby Anderson <[EMAIL PROTECTED]> wrote:
>
>
> What does your form look like? Chances are the form isn't passing a
> null value to the controller - its got some other value ('--')
> inst
What does your form look like? Chances are the form isn't passing a
null value to the controller - its got some other value ('--')
instead.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post
The beforeSave looks ok, except that '--' is not empty, so the unset()
won't be called. Perhaps you want to do a regex check instead of
empty() ?
On Dec 31, 10:44 am, Jamie <[EMAIL PROTECTED]> wrote:
> Apologies as I'm new to cake, as well as MVC.
>
> I have a table with a field called "obtaine
Apologies as I'm new to cake, as well as MVC.
I have a table with a field called "obtained_date", where null is
allowed.
I have the edit action in the controller which was created by bake:
function edit($id = null) {
if (empty($this->data)) {
if (
OK I think I've got it now, thank you both very much for your help.
On Jul 5, 1:44 pm, Walker Hamilton <[EMAIL PROTECTED]> wrote:
> Yeah, what ketan said.
>
> It's not telling your model to use a callback. it's making it so that
> multiple levels of the (inherited) beforeSave function ( App Model
I'm still a little confused.
So I keep what I have right now ($this->data[) in my beforeSave()
and then do what?
Walker Hamilton wrote:
> you shouldn't need to create a hidden field called 'name'.
>
> just do the assignation in beforeSave.
>
> you need to make sure your beforeSave in the mode
Yeah, what ketan said.
It's not telling your model to use a callback. it's making it so that
multiple levels of the (inherited) beforeSave function ( App Model
Class -> Model Name Class ) all get run.
On Jul 5, 1:33 pm, Ketan Patel <[EMAIL PROTECTED]> wrote:
> If you defined function beforeSave
If you defined function beforeSave() in your controller then
essentially you are overriding the beforeSave function defined in
AppController and its parent Controller.
So by calling parent::beforeSave() you are telling, you want to call
the beforeSave method of the parent class which AppControll
Ah, I see now. Thanks for spelling that out for me. It works quite
well :)
So parent::beforeSave() essentially tells the model to use the
beforeSave callback?
Walker Hamilton wrote:
> function beforeSave()
> {
>
> if(isset($this->data['ItemData']['common_name']))
> $this->data['Item']['name'] = $
function beforeSave()
{
if(isset($this->data['ItemData']['common_name']))
$this->data['Item']['name'] = $this->data['ItemData']['common_name'];
return parent::beforeSave();
}
On Jul 5, 12:54 pm, Brian <[EMAIL PROTECTED]> wrote:
> I'm still a little confused.
>
> So I keep what I have right no
you shouldn't need to create a hidden field called 'name'.
just do the assignation in beforeSave.
you need to make sure your beforeSave in the model returns
parent::beforeSave
On Jul 5, 12:19 pm, Brian <[EMAIL PROTECTED]> wrote:
> Here's a quick synopsis of the scenario: There's a menu, which h
Here's a quick synopsis of the scenario: There's a menu, which has
items, and these have a name and price. I also have a table in a
separate database that has a ton of information on every item. I've
got an AutoCompleter set up with this third table(ItemData, field
'common_name') and what I would
Thnk you, Nate
There are 3 fileds on which the duplicate search is based, so if I
understad correctly I have to invalidate all of 3.
But they are also checked for validation like VALID_NOT_EMPTY, so I
can't taylor the error message based on the specific failure, eg "this
field can't be empty" vs
If there was a particular field in the model that the duplicate search
was based on, you could use Model::invalidate to invalidate that field,
and then use $html->tagErrorMsg with that field, to display the message.
--~--~-~--~~~---~--~~
You received this message
This is my first attempt to use callback functions in cake so soory if
is a dumb question...
I'm using beforeSave() to check if an Order containing a defined set of
data is already present in db.
If it is already there then I would like to display a choice to the
user between 'Keep adding this' o
17 matches
Mail list logo