It doesn't work for password because type="password" for that field. It 
doesn't work for postcode because your dictionary has "post_code" as the 
key instead of "postcode", which is the name of the form field.

Anthony

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<javascript:>> 
> 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<javascript:>> 
> 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<javascript:>
> >
> >> 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<javascript:>
> >
> >> > 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
> >> >>
> >> >> --
> >> >>
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> >
> >> >
> >> >
> >>
> >> --
> >>
> >>
> >>
> >
> >
> > --
> >  
> >  
> >  
>
>

-- 



Reply via email to