Massimo, this one works best (in html.py):

    def hidden_fields(self):
        c = []
        if self.attributes.has_key('hidden'):
            for (key, value) in self.attributes.get('hidden',
                    {}).items():
                c.append(INPUT(_type='hidden', _name=key,
_value=value))
        if hasattr(self, 'formkey') and self.formkey:
            c.append(INPUT(_type='hidden', _name='_formkey',
                     _value=self.formkey))
        if hasattr(self, 'formname') and self.formname:
            c.append(INPUT(_type='hidden', _name='_formname',
                     _value=self.formname))
        return TAG.div(c) ### <- just a div :-)

On 6 avr, 20:38, desfrenes <desfre...@gmail.com> wrote:
> Yes Massimo, that fixes the markup but also introduces borders in
> forms which is probably not what you want. a div would be better like
> DenesL said.
> For the textarea, it seems to be ok, at least with SQLFORM.
>
> On 6 avr, 17:05, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > Try the latest trunk. It should be fixed but I did not try to
> > revalidate.
>
> > Massimo
>
> > On Apr 6, 9:34 am, DenesL <denes1...@yahoo.ca> wrote:
>
> > > On Apr 5, 9:09 pm, desfrenes <desfre...@gmail.com> wrote:>Hi,
>
> > > First of all, good catches!.> Is it possible to make the default markup 
> > > for SQLFORMs w3c valid ?
> > > +1
> > > > Right now there are hidden inputs (I suppose they're here for anti-
> > > > CSRF) which are not in block elements. This problem can be addressed
> > > > easily by using a fieldset.
>
> > > I would suggest a DIV instead of FIELDSET, the latter draws a box
> > > arount the hidden elements.> And also textareas have a "type" attribute 
> > > which is not valid (what
> > > > for ?).
>
> > > The problem here is that in gluon/html.py the class TEXTAREA is
> > > derived from class INPUT (in turn derived from class DIV which is the
> > > base class for most helpers). So whatever INPUT has, as "type", is
> > > available to TEXTAREA.
>
> > > On Apr 6, 4:23 am, desfrenes <desfre...@gmail.com> wrote:> See down this 
> > > page for a valid markup form 
> > > example:http://www.desfrenes.com/blog/post/quel-framework-web-python-choisir
> > > > It is implemented using definition lists (<dl>, <dt>, <dd>) which is
> > > > way more flexible than tables in terms of css styling.
>
> > > > Of course, you don't have to use definition lists but at least if you
> > > > use tables, the markup should be valid.
>
> > > +1
>
> > > > Digging through web2py's code I found that SQLFORM seems tied to
> > > > certain HTML elements since you use TR helper. How a user is supposed
> > > > to change the markup ? Other frameworks (see Zend for example) use
> > > > form decorators to achieve this so it's always possible to change the
> > > > markup. Does web2py allow that ?
> > > > If it's not possible, web2py should use a markup that is more flexible
> > > > (like the definition list).
>
> > > +1 !
> > > I tried to suggest this in the past but it was unclear (to me) how to
> > > achieve it.
> > > Currently I am running some tests with jQuery UI.
>
> > > > Web2py advertises that it "enforces good software engineer practices",
> > > > which is great, but I think it should also enforce good web
> > > > development pratices such as the respect for w3c's standards.
>
> > > > For now, apart from the flexibility issue, here's how a web2py form
> > > > could be valid:http://www.desfrenes.com/goodweb2pymarkup(original
> > > > form markup is here:http://www.desfrenes.com/badweb2pymarkup).
>
> > > > The changes are minor, just putting the hidden inputs in invisible <p>
> > > > and replacing type="text" in textarea with class="text".
>
> > > > What do you think ? I really like the idea of having automated forms,
> > > > but strict conformance to dtds is part of our quality policy here.
> > > > Without it, I'm left to hand-writing forms in the view.
>
> > > > Regards,
>
> > > > Mickaël.
>
> > > > ps: this firefox extension is a 
> > > > must:http://users.skynet.be/mgueury/mozilla/
> > > > . It allows for easy markup validation.
>
> > > > On Apr 6, 6:53 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > This may break backward compatibility. Anyway, send me an example of
> > > > > how you think the output should be.
>
> > > > > Massimo
>
> > > > > On Apr 5, 8:09 pm, desfrenes <desfre...@gmail.com> wrote:
>
> > > > > > Hi,
>
> > > > > > Is it possible to make the default markup for SQLFORMs w3c valid ?
>
> > > > > > Right now there are hidden inputs (I suppose they're here for anti-
> > > > > > CSRF) which are not in block elements. This problem can be addressed
> > > > > > easily by using a fieldset.
>
> > > > > > And also textareas have a "type" attribute which is not valid (what
> > > > > > for ?).
>
> > > > > > These issues may be minor but since browsers are very "sensible", I
> > > > > > prefer to avoid quirks.
>
> > > > > >> Mickael.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to