Paul,

This sounded like a good approach, so I tried it out in a scenario
where I'm having some similar problems to what you described.

The issue that I noticed though, was that in combining the defaults
with the tainted values, I get back values for fields which I've
specifically unset() in my Form configuration (created_at,
modified_at, etc). So basically, to use this method, I'd need to be
able to take into account which fields have been unset somehow.

I'll see if I can figure anything out, because it seems to at least be
a step in the right direction for submitting on certain parts of a
Form, without setting other values to NULL.

That is of course, unless someone else can point out a better way to
do this?

Cheers,
Beau


On Oct 3, 1:34 pm, "Paul Jones" <[EMAIL PROTECTED]> wrote:
> So I have worked around the problem I discovered. In the BaseFormPropel
> class I overrode the bind method so that, in essence, $taintedValues start
> with the default values instead of starting with all null values. This way
> if I do not pass in a value, the current value is not changed.  I can still
> set a value to null if I pass in the key with a null value, but I can also
> now leave a value unchanged.
> public function bind(array $taintedValues = null, array $taintedFiles =
> null)
> {
> $taintedValues = array_merge($this->getDefaults(), $taintedValues);
> parent::bind($taintedValues, $taintedFiles);
>
> }
>
> I think it would be nice to have this type of functionality available as a
> option in forms generally, especially in a REST context. Anyone else think
> this would be nice, or see any blatant problems with this?
>
> Thanks,
> paul
>
> On Fri, Oct 3, 2008 at 10:13 AM, Paul Jones <[EMAIL PROTECTED]> wrote:
> > Hello,
>
> > I have a question about how forms are supposed to behave. I generated
> > a basic crud interface and interact with it via ajax. When I call the
> > update method a sfFormPropel form is created, the post data is bound
> > to the form and then the form is saved if it is valid. All the basic
> > stuff. The only interesting thing is that if I only submit the id and
> > name of the object, then all the other fields are saved as null. I
> > expected fields that I did not submit to be left untouched. Did I have
> > the wrong expectations or did I uncover a bug?
>
> > I am using symfony 1.2 HEAD.
>
> > Thanks in advance,
> > paul

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to