Try: for input in form.elements("input[type=text]"):
On Thursday, August 30, 2012 3:51:13 AM UTC-4, Alec Taylor wrote: > > No placeholders are added to the HTML. > > Here is the output: http://pastie.org/4615036 > > On Thu, Aug 30, 2012 at 3:02 PM, Anthony <abas...@gmail.com > <javascript:>>wrote: > >> Can you explain more about what doesn't work? Does the HTML source code >> end up not as expected, or is the browser just not rendering it as expected? >> >> >> On Thursday, August 30, 2012 12:01:18 AM UTC-4, Alec Taylor wrote: >> >>> Thanks, but unfortunately that didn't work. >>> >>> {{ >>> form=auth.register() >>> my_extra_element = CAT('Agree to ', A('terms & conditions', >>> _href="/legal/agreement/")), >>> INPUT(_name='agree',value=True**,_type='checkbox') >>> form[0].insert(-1,my_extra_**element)for label in form.elements('label'): >>> label["_style"] = "display:none;"pass >>> >>> placeholders = { >>> "email": "enter a valid email address", >>> "password": "be secure", >>> "post code": "3434343-3434383", >>> "validator": "captcha"}for input in >>> form.elements("input[type='**text']"): >>> input["_placeholder"] = placeholders.get(input["_name"**], "")pass >>> =form}} >>> >>> >>> (this is in my view; and yes, I should move it to a controller, but want >>> to get it working first) >>> >>> On Thu, Aug 30, 2012 at 4:11 AM, Bruno Rocha <rocha...@gmail.com> wrote: >>> > placeholders = { >>> > "name": "fill in your name", >>> > "email": "enter a valid email address" >>> > } >>> > >>> > for input in form.elements("input[type='**text']"): >>> > input["_placeholder"] = placeholders.get(input["_name"**], "") >>> > >>> > >>> > On Wed, Aug 29, 2012 at 3:07 PM, Alec Taylor <alec.t...@gmail.com> >>> wrote: >>> >> >>> >> Thanks, also would there be a loop I can add before that to set the >>> >> placeholder of each input? >>> >> >>> >> On Thu, Aug 30, 2012 at 3:58 AM, Bruno Rocha <rocha...@gmail.com> >>> >>> >> wrote: >>> >> > for label in form.elements('label'): >>> >> > label["_style"] = "display:none;" >>> >> > >>> >> > >>> >> > >>> >> > >>> >> > On Wed, Aug 29, 2012 at 2:47 PM, Alec Taylor <alec.t...@gmail.com> >>> >>> >> > wrote: >>> >> >> >>> >> >> How do I remove labels from forms? >>> >> >> >>> >> >> I want to use placeholders instead... >>> >> >> >>> >> >> (this is for the auth.register form) >>> >> >> >>> >> >> Thanks for all suggestions, >>> >> >> >>> >> >> Alec Taylor >>> >> >> >>> >> >> -- >>> >> >> >>> >> >> >>> >> >> >>> >> > >>> >> > >>> >> > -- >>> >> > >>> >> > >>> >> > >>> >> >>> >> -- >>> >> >>> >> >>> >> >>> > >>> > >>> > -- >>> > >>> > >>> > >>> >>> -- >> >> >> >> > > --