Well... What should I validate in a compound widget such as the AutoCompleteField? The syntax of a validator looks like:
name = validator Where name is the parameter that is being returned from HTML. The problem is that the name that is generated there is not tied to the name I provided. Here's the HTML generated for the AutoCompleteField that I mentioned in #777: =============================================================================== <DIV> <SCRIPT TYPE="text/JavaScript" LANGUAGE="JavaScript"> AutoCompleteManagerform_endereco = new AutoCompleteManager('form_endereco', 'form_endereco_endereco_text', 'form_endereco_hidden', '/fornecedores/search_endereco', 'endereco', 'enderecos',false); addLoadEvent(AutoCompleteManagerform_endereco.initialize); </SCRIPT> <INPUT NAME="endereco.endereco_text" CLASS="textfield" TYPE="text" ID="form_endereco_endereco_text" VALUE="R. Poeta Francisco Ferreira Leite, 40 - 6" SIZE="51"> <IMG SRC2="/tg_widgets/turbogears.widgets/spinner.gif" SRC="/tg_widgets/turbogears.widgets/spinnerstopped.png" NAME="autoCompleteSpinnerendereco" ID="autoCompleteSpinnerform_endereco"> <DIV CLASS="autoTextResults" ID="autoCompleteResultsform_endereco" NAME="autoCompleteResultsendereco"> </DIV> <INPUT CLASS="hiddenfield" TYPE="hidden" ID="form_endereco_hidden" NAME="endereco.hidden"> </DIV> =============================================================================== I want to validate, e.g., the field that has the name "endereco.endereco_text" -- the name I gave to the AutoCompleteField was "endereco" and the name for the text_field was "endereco_text". The code is: =============================================================================== endereco = widgets.AutoCompleteField( search_controller="/fornecedores/search_endereco", search_param="endereco", result_name="enderecos", text_field = widgets.TextField(name = 'endereco_text', attrs = {'size':51}, label = _(u'Endereço'),)) =============================================================================== The derived name is not obvious and one will always have to look at the output to know the name of the field he'll be validating since it isn't anything he typed in. I'd expect to have to validate "endereco_text" or even just "endereco" since I haven't specified a hidden field but have specified a text_field. But since it is made of two separate widgets, I'd be fine validating the inner field. What I want here? To write something like: endereco.endereco_text = validators.UnicodeString() But if I do that, then I'll receive an error message stating that there's no 'endereco' object or not 'endereco_text' attribute for the inexistent object. Won't I? <testing> Yes, I get an error: =============================================================================== NameError: name 'endereco' is not defined =============================================================================== So, if the name there has a "." in it, I can't create a Schema with that name and this name is what is returned as the key in the key=value pair that we receive from the web before any processing. What should I write as the validator name to validate this field? And why are validators for the form ignored when I declare them on the widgets.WidgetsList and concatenate several of these into a form? -- Jorge Godoy <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group. To post to this group, send email to turbogears-trunk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears-trunk -~----------~----~----~----~------~----~------~--~---