Jorge Godoy wrote:
>Jose Soares <[EMAIL PROTECTED]> writes:
>
>
>
>>The first time I display the form it contains correct data.
>>When I change the group by selecting it from the SingleSelectField the
>>values in the form don't change.
>>
>>
>
>You're probably not passing a callable, so the form gets its content and never
>call the function again. It's the same thing as passing a static value.
>
The index function calls ricercaForm(gruppo) which returns the widget
and every time 'gruppo' changes
ricercaForm() is called and it returns the right data every time (I see
it with pdb).
Then the result is passed to the template as
dict(formEdit=ricercaForm(gruppo), context=data)
which contains: ${formEdit(context)}
but...
-------------------------------------------------------------------------------------------------
def ricercaForm(gruppo=None):
return TableForm(caption='assegnazione permessi', action='index',
fields = [
widgets.SingleSelectField(name='cod_ruolo',label='codice
ruolo',options=opt_ruoli,
attrs=dict(onchange='form.submit()')),
SelectShuttle(
name = 'permessi_options',
available_options=dispon(),
default = dict(selected = assegn(gruppo) ),
title_selected = 'Permessi assegnati',
title_available = 'Permessi non assegnati',
label=''
)
]
)
class Controller:
@identity.require(identity.has_permission("ruoli_permessi"))
@identity.require(identity.in_any_group("sysadm"))
@expose(template="kid:sicer.templates.tabella.edit")
def index(self, **data):
gruppo=data.get('cod_ruolo')
return dict(formEdit=ricercaForm(gruppo), context=data
-----------------------------------------
jo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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?hl=en
-~----------~----~----~----~------~----~------~--~---