Hi Jorge,
On Apr 21, 2007, at 4:57 AM, Jorge Godoy wrote:
>
>
> Hi!
>
>
> I've been talking to Roger about a problem I was having with some
> AJAX things to allow editing a complex form I'm creating for an
> application.
>
> The thing that was causing me more problems was filling fields that
> depend on previous values to get their own values, a kind of
> cascade of
> options. This happens when I'm editing existing records and I need to
> display data to my users.
>
> I tried to populate those with known values before displaying the
> form,
> to avoid unneeded roundtrips from the client's machine to the
> server to
> get values that I know that should be on the form.
>
> What I did was:
(...)
> What I needed here was some mean to replace the empty list of options
> with a real list of options that is valid in this context.
>
> I can replace the options using AJAX, but this would add the
> undesirable
> roundtrip plus some other logic that I'd like to avoid if I can.
> (Specially on setting the selected option...)
>
>
> I've tried this:
>
> ======================================================================
> ==========
> In [10]: fpd.get_field_by_name('contatoClienteBeneficiado').options
> [:]=[]
>
> In [11]: fpd.get_field_by_name
> ('contatoClienteBeneficiado').options.append(Contatos.get_contatos(1))
> ======================================================================
> ==========
(...)
> Is it really not allowed? Is it possible to do what I want? If
> so, any
> hints on how could I achieve that?
You can't modify the widget's attributes once it has been
initialized. The __setattr__ check doesn't kick in because you're not
rebinding any attribure but, nevertheless, you can't do this. Have
you tried this?:
fpd.display(options=dict
(contatoClienteBeneficiado=Contatos.get_contatos(1)))
Alberto
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" 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/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---