Hi Krasimir:

$this->widgetSchema['mydate']->setAttribute('date', array('disabled'=>
'disable'));
$this->widgetSchema['mydate']->setAttribute('time', array('disabled'=>
'disable'));

Should disable the date and time parts of the widget, however when you
disable a widget it doesn't send any value in the post.
I think using JS could solve your problem.

If you disabled the widget from editing because you don't want this
data to be overwrited by the user you could disable the widget and
then you could create your own updateObject() function in your form
and set the value yourself. Or you could create your own bind
function.

Hope this helps.

On Sep 2, 3:25 pm, Krasimir Ivanov <[EMAIL PROTECTED]> wrote:
> Thank you for the info. Your method really disable the input, but
> after validation of the form it says that this field has no property
> like it is empty and display error that this field is required. And
> also this method works on simple fields but on sfWidgetFormDateTime()
> it didn't work.
> Date time makes complicated structure.
> <select name="sf_guard_user_profile[date_reg][month]"
> id="sf_guard_user_profile_date_reg_month">...
> <select name="sf_guard_user_profile[date_reg][day]"
> id="sf_guard_user_profile_date_reg_day">...
> <select name="sf_guard_user_profile[date_reg][year]"
> id="sf_guard_user_profile_date_reg_year">...
>
> <select name="sf_guard_user_profile[date_reg][hour]"
> id="sf_guard_user_profile_date_reg_hour">...
> <select name="sf_guard_user_profile[date_reg][minute]"
> id="sf_guard_user_profile_date_reg_minute">...
>
> On 2 Септ, 18:01, paolovas <[EMAIL PROTECTED]> wrote:
>
> > You could do something like this: 
> > $this->widgetSchema['your_field_to_be_disabled']->setAttribute('disabled',
>
> > 'disable');
>
> > Regards,
>
>
--~--~---------~--~----~------------~-------~--~----~
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