Try to force the setting of the 'widgets' attribute of FieldSet, replace "widgets.FieldSet([" by "widgets.FieldSet(widgets=["
Jorge Godoy a écrit :
David Bernard <[EMAIL PROTECTED]> writes:Could you send the kid fragment and the controller fragment ?Sure. My form declaration and its use: ================================================================================ class UnicodeString(validators.String): def _from_python(self, value, state): if value: return unicode(value) if value == 0: return unicode(value) return '' class Clientes: formulario = widgets.TableForm( widgets = ( widgets.TextField(attrs = {'size':31, 'maxlength':30}, name = 'nome_abreviado', labeltext = _('Nome abreviado'), css_classes = ['required'], validator = validators.NotEmpty()), widgets.TextField(attrs = {'size':51, 'maxlength':80}, name = 'nome_completo', labeltext = _(u'Razão social'), css_classes = ['required'], validator = validators.NotEmpty()), widgets.TextField(attrs = {'size':51}, name = 'endereco', labeltext = _(u'Endereço'), validator = UnicodeString(if_empty = None)), #widgets.FieldSet([ widgets.TextField(attrs = {'size':30, 'maxlength':60}, name = 'cidade', labeltext = _('Cidade'), validator = UnicodeString(if_empty = None)), widgets.TextField(attrs = {'size':3, 'maxlength':2}, name = 'estado', labeltext = _('Estado'), validator = UnicodeString(if_empty = None)), widgets.TextField(attrs = {'size':10, 'maxlength':9}, name = 'cep',labeltext = _('CEP'), validator = UnicodeString(if_empty = None)),#]), widgets.TextField(attrs = {'size':15, 'maxlength':14}, name = 'fone', labeltext = _('Telefone'), validator = UnicodeString(if_empty = None)), widgets.TextField(attrs = {'size':15, 'maxlength':14}, name = 'fax', labeltext = _('FAX'), validator = UnicodeString(if_empty = None)), widgets.TextField(attrs = {'size':51, 'maxlength':80}, name = 'contato', labeltext = _('Contato'), validator = UnicodeString(if_empty = None)), widgets.TextField(attrs = {'size':51, 'maxlength':80}, name = 'email', labeltext = _('Email'), validator = UnicodeString(if_empty = None)), widgets.TextField(attrs = {'size':18, 'maxlength':17}, name = 'cnpj', labeltext = _('CNPJ'), validator = UnicodeString(if_empty = None)), widgets.TextField(attrs = {'size':21, 'maxlength':20}, name = 'ie', labeltext = _(u'Inscrição Estadual'), validator = UnicodeString(if_empty = None)), widgets.TextField(attrs = {'size':21, 'maxlength':20}, name = 'cpf', labeltext = _('CPF'), validator = UnicodeString(if_empty = None)), widgets.TextField(attrs = {'size':21, 'maxlength':20}, name = 'contrato', labeltext = _(u'Código do contrato'), validator = UnicodeString(if_empty = None)), widgets.CalendarDatePicker(attrs = {'size':11, 'maxlength':10}, name = "contrato_assinatura", format = _("%d/%m/%Y"), button_text = _(u"Calendário"), lang = _('pt-utf8'), labeltext = _('Data de assinatura do contrato')), widgets.CalendarDatePicker(attrs = {'size':11, 'maxlength':10}, name = "contrato_vencimento", format = _("%d/%m/%Y"), button_text = _(u"Calendário"), lang = _('pt-utf8'), labeltext = _('Data de vencimento do contrato')), widgets.CheckBox(name = 'auto_renovar', labeltext = _(u'Esse contrato é auto-renovável')), widgets.CheckBox(name = 'is_ativo', labeltext = _(u'Esse cliente está ativo'), validator = validators.Bool(if_empty = False)), widgets.HiddenField(name = 'cliente_id', validator = validators.Int(if_empty = None)) )) @turbogears.expose(html="site_amostras.templates.clientes") def clientes(self, cliente_id): clientes = self.getTodosClientes() data_new = dict( contrato_assinatura = '', contrato_vencimento = '', cliente_id = None, nome_abreviado = None, nome_completo = None, contrato = None, endereco = None, cidade = None, estado = None, cep = None, cnpj = None, ie = None, cpf = None, contato = None, email = None, fone = None, fax = None, auto_renovar = None, is_ativo = True, )if cliente_id:cliente = model.Cliente.get(cliente_id)data_assinatura = ''data_vencimento = '' contrato = None auto_renovar = None if cliente.contrato is not None: contrato = cliente.contrato.codigo data_assinatura = cliente.contrato.dataAssinatura if cliente.contrato.dataVencimento: data_vencimento = cliente.contrato.dataVencimento auto_renovar = cliente.contrato.autoRenovar valores = dict(cliente_id = cliente.id, nome_abreviado = cliente.nomeAbreviado,nome_completo = cliente.nomeCompleto, contrato = contrato, endereco = cliente.endereco, cidade = cliente.cidade, estado = cliente.estado, cep = cliente.cep, cnpj = cliente.cnpj, ie = cliente.ie, cpf = cliente.cpf, contato = cliente.contato, email = cliente.email, fone = cliente.fone, fax = cliente.fax, contrato_assinatura = data_assinatura, contrato_vencimento = data_vencimento, auto_renovar = auto_renovar, is_ativo = cliente.isAtivo) return dict(clientes=clientes, cliente_id=cliente.id, data = valores, data_new = data_new, formulario = self.formulario, usuario=identity.current.user) else: return dict(clientes=clientes, cliente_id=cliente_id, formulario = self.formulario, data_new = data_new, usuario=identity.current.user) ================================================================================ The relevant part of my kid template: ================================================================================ <div py:if="cliente_id and usuario"> <br /> <h1>Editar cliente</h1> <div py:strip='1'> ${formulario.insert(data, action='/clientes/update', method = 'post')} </div> <p><a href='/'>Retornar à página principal</a></p> </div> <div py:if="usuario"> <br /> <h1>Novo cliente</h1> <div py:strip='1'> ${formulario.insert(data_new, action='/clientes/save')} </div> <p><a href='/'>Retornar à página principal</a></p> </div> </div> ================================================================================ Now, if you look in the code for FieldSet you'll see that the reference to "widget" is there, this is why I asked about how to use widgets.FieldSet, since I believe I'm using it like the sample code (which only uses a"[TextField()]" as its contents).So, there's no "widget" on my code. :-) And the FieldSet still doesn'twork...
--------------------------------------------------------------
David "Dwayne" Bernard Freelance Developer
mailto:[EMAIL PROTECTED]
\|/ http://dwayne.java-fan.com
--o0O @.@ O0o-------------------------------------------------
signature.asc
Description: OpenPGP digital signature

