Not quite clear what the problem is. What you put in the view shouldn't matter -- that just generates the HTML to display the widgets -- it doesn't have anything to do with validation (and form.custom.widget.fieldname will produce the same HTML as form.element(_name='fieldname')). Of course, you won't be able to use form.custom.widget.fieldname for the fields you manually added to the form.
If you have time, perhaps you could produce a minimal app that replicates the problem. Include one page that uses form.custom.widget and one that uses form.element(), and explain how they behave differently. Also, note that form.elements()[0][0] is simply equivalent to form[0]. Anthony On Thursday, October 24, 2013 9:07:09 PM UTC-4, Diogo Munaro wrote: > > Here my controller and view: http://pastebin.com/AXGx99UN > > If I use form.custom.widget.first_name (for example). It's doesn't work. > > Another thing, if I insert: > > form2.element(_name="city_id")['_type']='hidden' > > after: > > if form2.process().accepted: > > It's returns a text field before the validation instead of a hidden field. > > > 2013/10/23 Diogo Munaro <diogo....@gmail.com <javascript:>> > >> Now it's working only with form.element(_name="first_name"). >> >> The controller is the same for 2 types. Tomorrow I'll post everything, >> but now I can post the controller simple structure: >> >> def register(): >> form = SQLFORM.factory(db.person, db.auth_user,db.researcher) >> if form.process().accepted: >> ##register people in db >> >> The view was the same... I need a auth structure with 3 tables: >> >> People has n auth and auth has n researcher, and I really need it... >> >> Em terça-feira, 22 de outubro de 2013 17h31min40s UTC-2, Anthony escreveu: >>> >>> Please show all of your controller and view code. >>> >>> On Tuesday, October 22, 2013 3:18:16 PM UTC-4, Diogo Munaro wrote: >>>> >>>> Sorry Antony, I forgot the = here, but the code have it. >>>> >>>> The fields are there, but no validators work >>>> >>>> Em terça-feira, 22 de outubro de 2013 12h33min37s UTC-2, Anthony >>>> escreveu: >>>>> >>>>> {{form.custom.begin}} >>>>>> >>>>>> {{form.custom.widget.first_**name}} >>>>>> >>>>>> {{form.custom.submit}} >>>>>> {{form.custom.end}} >>>>>> >>>>> Is that the actual code? If so, you need to precede each item above >>>>> with an "=". >>>>> >>>>> >>>>>> The fields comes without validators. Then, it reflect problems with >>>>>> form.process().accepted >>>>>> >>>>> Validation happens in the controller when form.process() is called, >>>>> not in the view. So you still get validation when you use >>>>> form.custom.widget. >>>>> >>>>> >>>>>> {{form.custom.begin}} >>>>>> {{=form.element(_name="first_**name")}} >>>>>> >>>>> form.element(_name="first_**name") is the same as >>>>> form.custom.widget.first_name. >>>>> >>>>> Anthony >>>>> >>>> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "web2py-users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/web2py/ggzIjyqNoSQ/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> web2py+un...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.