Hi Olmo,

Take a look at the sfValidatorCallback class. Using this, you should  
be able to create a callback that always returns the widget's default  
value, rendering the field uneditable.

Kris

On Sep 19, 2008, at 3:07 PM, Marijn Huizendveld <[EMAIL PROTECTED] 
 > wrote:

> Hi Ibolmo,
>
> You can just do this in your forms doSave() method:
>
> $values = $this->getValues();
>
> unset($values['yourFieldName']);
>
> $this->values = $values;
>
> Does that answer your question?
>
> Marijn
>
> On Sep 19, 2008, at 11:56 PM, ibolmo wrote:
>
>>
>> Pardon the trace error is here: 
>> http://pastie.org/private/o9pryue9tkjhqx5csppa
>>
>> On Sep 19, 2:55 pm, ibolmo <[EMAIL PROTECTED]> wrote:
>>> I've tried the following:http://pastie.org/private/mdbttlrv8yf7lxiz6zvs9g
>>>
>>> Basically, I don't want my participants to change their email. So  
>>> I've
>>> disabled the field.
>>>
>>> Since it's disabled, PHP will not set the key/value in the  
>>> response to
>>> a null value.
>>>
>>> I was expecting that Doctrine would only update the $taintedValues,
>>> but I noticed a trace error from the Database due to 
>>> invalidation:http://pastie.org/pastes/new
>>>
>>> I assumed it to be a problem with Doctrine, but then I realized that
>>> it's a behavioral problem with sfForms.
>>>
>>> The problem lies in $this->getValues().
>>>
>>> getValues will return an array of all the validators in the
>>> validatorSchema and thusly will include 'email_address' => null  
>>> since
>>> truthfully the form does not include the email_address (since it was
>>> disabled).
>>>
>>> Correspondingly, I've updated the code to the 
>>> following:http://pastie.org/private/jcrarwmnc8uvcidmiegda
>>>
>>> Effectively, I unset the validator and now $this->getValues() does  
>>> not
>>> include the email address.
>>>
>>> I feel like the sfForm should have a better way to handle this
>>> behavior. In particular, it should either:
>>>  1. notice that a field is disabled, and such the validator is
>>> disabled (or unset)
>>>  2. should have a function similar to offsetUnset -- perhaps
>>> offsetDisable
>>>
>>> I'd like to hear your opinion on this behavior issue -- or if in  
>>> fact
>>> it is an issue.
>>>
>>> Olmo
>>
>
>
> >

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

Reply via email to