Re: [web2py] Removing labels from forms

2012-09-17 Thread Richard Vézina
Right!

I have a questioning about placeholder attribute. I don't know what the
plans about integration of html5 into web2py (since placeholder is a new
attribute of input in html5), but the only place where it makes sens to set
the placeholder value is at the field definition in the model I think. I
don't know if it makes sens to have html attributes there. One thing for
sure is that having placeholder support in web2py, would limit the overhead
of modifying the form once it created.

Richard

On Wed, Sep 12, 2012 at 2:26 PM, Anthony abasta...@gmail.com wrote:

 It should be 'input[type=text]' instead of input[type='text'] (i.e., no
 quotes around text when using that syntax).

 Anthony


 On Wednesday, September 12, 2012 1:59:57 PM UTC-4, Richard wrote:

 I will try, but Bruno's code was :

 for input in form.elements(input[type='tex**t']):
 input[_placeholder] = placeholders.get(input[_name**], )

 And it didn't catch anything...

 input[] return all the input...

 Anyway, I try and I report.

 Richard

 On Wed, Sep 12, 2012 at 1:11 AM, Anthony abas...@gmail.com wrote:

 The proper code I come up with :

 {{{
 for input_elem in form.elements(input[]):
 if input_elem.attributes['_type']=='text':
 input_elem[_placeholder] = YOURPLACEHOLDERTEXT
 }}}


 Why not just form.elements('input[type=**text]') or form.elements('input',
 _type='text')?

 Anthony

 --





  --





-- 





Re: [web2py] Removing labels from forms

2012-09-17 Thread Richard Vézina
Maybe the proper way to append attributes to field is by widget as Anthony
wrote here :
http://stackoverflow.com/questions/8661166/custom-css-classes-for-sqlform-widget-input-in-web2py/8661906#8661906

From this thread :
https://groups.google.com/forum/?fromgroups=#!topic/web2py/c-0EMp26uDc

Richard

On Mon, Sep 17, 2012 at 1:53 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 Right!

 I have a questioning about placeholder attribute. I don't know what the
 plans about integration of html5 into web2py (since placeholder is a new
 attribute of input in html5), but the only place where it makes sens to set
 the placeholder value is at the field definition in the model I think. I
 don't know if it makes sens to have html attributes there. One thing for
 sure is that having placeholder support in web2py, would limit the overhead
 of modifying the form once it created.

 Richard


 On Wed, Sep 12, 2012 at 2:26 PM, Anthony abasta...@gmail.com wrote:

 It should be 'input[type=text]' instead of input[type='text'] (i.e.,
 no quotes around text when using that syntax).

 Anthony


 On Wednesday, September 12, 2012 1:59:57 PM UTC-4, Richard wrote:

 I will try, but Bruno's code was :

 for input in form.elements(input[type='tex**t']):
 input[_placeholder] = placeholders.get(input[_name**], )

 And it didn't catch anything...

 input[] return all the input...

 Anyway, I try and I report.

 Richard

 On Wed, Sep 12, 2012 at 1:11 AM, Anthony abas...@gmail.com wrote:

 The proper code I come up with :

 {{{
 for input_elem in form.elements(input[]):
 if input_elem.attributes['_type']=='text':
 input_elem[_placeholder] =
 YOURPLACEHOLDERTEXT
 }}}


 Why not just form.elements('input[type=**text]') or form.elements('input',
 _type='text')?

 Anthony

 --





  --







-- 





Re: [web2py] Removing labels from forms

2012-09-17 Thread Richard Vézina
That's :

   for f in db[request.args(0)].fields:
if db[request.args(0)][f].type == 'text':
db[request.args(0)][f].widget = lambda field, value:
SQLFORM.widgets.text.widget(field, value, _placeholder='test123')

Richard

On Mon, Sep 17, 2012 at 2:22 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 Maybe the proper way to append attributes to field is by widget as Anthony
 wrote here :
 http://stackoverflow.com/questions/8661166/custom-css-classes-for-sqlform-widget-input-in-web2py/8661906#8661906

 From this thread :
 https://groups.google.com/forum/?fromgroups=#!topic/web2py/c-0EMp26uDc

 Richard


 On Mon, Sep 17, 2012 at 1:53 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Right!

 I have a questioning about placeholder attribute. I don't know what the
 plans about integration of html5 into web2py (since placeholder is a new
 attribute of input in html5), but the only place where it makes sens to set
 the placeholder value is at the field definition in the model I think. I
 don't know if it makes sens to have html attributes there. One thing for
 sure is that having placeholder support in web2py, would limit the overhead
 of modifying the form once it created.

 Richard


 On Wed, Sep 12, 2012 at 2:26 PM, Anthony abasta...@gmail.com wrote:

 It should be 'input[type=text]' instead of input[type='text'] (i.e.,
 no quotes around text when using that syntax).

 Anthony


 On Wednesday, September 12, 2012 1:59:57 PM UTC-4, Richard wrote:

 I will try, but Bruno's code was :

 for input in form.elements(input[type='tex**t']):
 input[_placeholder] = placeholders.get(input[_name**], )

 And it didn't catch anything...

 input[] return all the input...

 Anyway, I try and I report.

 Richard

 On Wed, Sep 12, 2012 at 1:11 AM, Anthony abas...@gmail.com wrote:

 The proper code I come up with :

 {{{
 for input_elem in form.elements(input[]):
 if input_elem.attributes['_type']=='text':
 input_elem[_placeholder] =
 YOURPLACEHOLDERTEXT
 }}}


 Why not just form.elements('input[type=**text]') or form.elements('input',
 _type='text')?

 Anthony

 --





  --








-- 





Re: [web2py] Removing labels from forms

2012-09-17 Thread Anthony
I tend to agree -- we already have label and comment -- why not 
placeholder?

Anthony

On Monday, September 17, 2012 1:53:39 PM UTC-4, Richard wrote:

 Right!

 I have a questioning about placeholder attribute. I don't know what the 
 plans about integration of html5 into web2py (since placeholder is a new 
 attribute of input in html5), but the only place where it makes sens to set 
 the placeholder value is at the field definition in the model I think. I 
 don't know if it makes sens to have html attributes there. One thing for 
 sure is that having placeholder support in web2py, would limit the overhead 
 of modifying the form once it created.

 Richard

 On Wed, Sep 12, 2012 at 2:26 PM, Anthony abas...@gmail.com 
 javascript:wrote:

 It should be 'input[type=text]' instead of input[type='text'] (i.e., 
 no quotes around text when using that syntax).

 Anthony


 On Wednesday, September 12, 2012 1:59:57 PM UTC-4, Richard wrote:

 I will try, but Bruno's code was : 

 for input in form.elements(input[type='tex**t']):
 input[_placeholder] = placeholders.get(input[_name**], )

 And it didn't catch anything...

 input[] return all the input...
  
 Anyway, I try and I report.

 Richard

 On Wed, Sep 12, 2012 at 1:11 AM, Anthony abas...@gmail.com wrote:

 The proper code I come up with :

 {{{
 for input_elem in form.elements(input[]):
 if input_elem.attributes['_type']=='text':
 input_elem[_placeholder] = 
 YOURPLACEHOLDERTEXT
 }}}


 Why not just form.elements('input[type=**text]') or form.elements('input', 
 _type='text')?

 Anthony

 -- 
  
  
  


  -- 
  
  
  




-- 





Re: [web2py] Removing labels from forms

2012-09-17 Thread Bruno Rocha
input type= value= placeholder= required=required /

required is another usefull html5 validator, but we already have required
in models but it is not reflected in widgets, maybe for compatibility it
needs a html_required=True

-- 





Re: [web2py] Removing labels from forms

2012-09-12 Thread Richard Vézina
I will try, but Bruno's code was :

for input in form.elements(input[type='text']):
input[_placeholder] = placeholders.get(input[_name], )

And it didn't catch anything...

input[] return all the input...

Anyway, I try and I report.

Richard

On Wed, Sep 12, 2012 at 1:11 AM, Anthony abasta...@gmail.com wrote:

 The proper code I come up with :

 {{{
 for input_elem in form.elements(input[]):
 if input_elem.attributes['_type']**=='text':
 input_elem[_placeholder] = YOURPLACEHOLDERTEXT
 }}}


 Why not just form.elements('input[type=text]') or form.elements('input',
 _type='text')?

 Anthony

 --





-- 





Re: [web2py] Removing labels from forms

2012-09-12 Thread Anthony
It should be 'input[type=text]' instead of input[type='text'] (i.e., no 
quotes around text when using that syntax).

Anthony

On Wednesday, September 12, 2012 1:59:57 PM UTC-4, Richard wrote:

 I will try, but Bruno's code was : 

 for input in form.elements(input[type='text']):
 input[_placeholder] = placeholders.get(input[_name], )

 And it didn't catch anything...

 input[] return all the input...

 Anyway, I try and I report.

 Richard

 On Wed, Sep 12, 2012 at 1:11 AM, Anthony abas...@gmail.com 
 javascript:wrote:

 The proper code I come up with :

 {{{
 for input_elem in form.elements(input[]):
 if input_elem.attributes['_type']**=='text':
 input_elem[_placeholder] = YOURPLACEHOLDERTEXT
 }}}


 Why not just form.elements('input[type=text]') or form.elements('input', 
 _type='text')?

 Anthony

 -- 
  
  
  




-- 





Re: [web2py] Removing labels from forms

2012-09-11 Thread Richard Vézina
input is a reserved word...

Richard

On Fri, Aug 31, 2012 at 1:01 PM, Alec Taylor alec.tayl...@gmail.com wrote:

 Perfect, thanks to you both :)

 --





-- 





Re: [web2py] Removing labels from forms

2012-09-11 Thread Richard Vézina
The proper code I come up with :

{{{
for input_elem in form.elements(input[]):
if input_elem.attributes['_type']=='text':
input_elem[_placeholder] = YOURPLACEHOLDERTEXT
}}}

Richard


On Tue, Sep 11, 2012 at 4:08 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 input is a reserved word...

 Richard


 On Fri, Aug 31, 2012 at 1:01 PM, Alec Taylor alec.tayl...@gmail.comwrote:

 Perfect, thanks to you both :)

 --







-- 





Re: [web2py] Removing labels from forms

2012-09-11 Thread Richard Vézina
Just a

{{{test}}}

Richard

On Tue, Sep 11, 2012 at 5:55 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 The proper code I come up with :

 {{{
 for input_elem in form.elements(input[]):
 if input_elem.attributes['_type']=='text':
 input_elem[_placeholder] = YOURPLACEHOLDERTEXT
 }}}

 Richard


 On Tue, Sep 11, 2012 at 4:08 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 input is a reserved word...

 Richard


 On Fri, Aug 31, 2012 at 1:01 PM, Alec Taylor alec.tayl...@gmail.comwrote:

 Perfect, thanks to you both :)

 --








-- 





Re: [web2py] Removing labels from forms

2012-09-11 Thread Anthony


 The proper code I come up with :

 {{{
 for input_elem in form.elements(input[]):
 if input_elem.attributes['_type']=='text':
 input_elem[_placeholder] = YOURPLACEHOLDERTEXT
 }}}


Why not just form.elements('input[type=text]') or form.elements('input', 
_type='text')?

Anthony

-- 





Re: [web2py] Removing labels from forms

2012-08-31 Thread Alec Taylor
Is it not possible to display the text Password?

Like they do in Twitter-Bootstrap examples:
http://twitter.github.com/bootstrap/base-css.html#forms

On Fri, Aug 31, 2012 at 12:54 AM, Anthony abasta...@gmail.com wrote:

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

  --





-- 





Re: [web2py] Removing labels from forms

2012-08-31 Thread Anthony
On Friday, August 31, 2012 6:41:14 AM UTC-4, Alec Taylor wrote:

 Is it not possible to display the text Password?


Sure you can. My point was that the code Bruno gave you specifically 
selects inputs of type text, so it's not touching the password field, 
which is type password.

Anthony

-- 





Re: [web2py] Removing labels from forms

2012-08-31 Thread Alec Taylor
Perfect, thanks to you both :)

-- 





Re: [web2py] Removing labels from forms

2012-08-30 Thread Alec Taylor
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 abasta...@gmail.com 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
  
   --
  
  
  
  
  
   --
  
  
  
 
  --
 
 
 
 
 
  --
 
 
 

  --





-- 





Re: [web2py] Removing labels from forms

2012-08-30 Thread Anthony
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
  
   --
  
  
  
  
  
   --
  
  
  
 
  --
 
 
 
 
 
  --
   
   
   

  -- 
  
  
  




-- 





Re: [web2py] Removing labels from forms

2012-08-30 Thread Alec Taylor
Thanks, but that only worked for the first input (email):

http://pastie.org/4616739

On Thu, Aug 30, 2012 at 9:43 PM, Anthony abasta...@gmail.com wrote:

 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 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_**ele**ment)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='**tex**t']):
 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='**tex**t']):
  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
  
   --
  
  
  
  
  
   --
  
  
  
 
  --
 
 
 
 
 
  --
 
 
 

  --





  --





-- 





Re: [web2py] Removing labels from forms

2012-08-30 Thread Anthony
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.comjavascript: 
 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.comjavascript: 
 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.comjavascript:
 
  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.comjavascript:
 
   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
  
   --
  
  
  
  
  
   --
  
  
  
 
  --
 
 
 
 
 
  --
   
   
   



-- 





Re: [web2py] Removing labels from forms

2012-08-29 Thread Bruno Rocha
for label in form.elements('label'):
label[_style] = display:none;




On Wed, Aug 29, 2012 at 2:47 PM, Alec Taylor alec.tayl...@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

 --





-- 





Re: [web2py] Removing labels from forms

2012-08-29 Thread Alec Taylor
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 rochacbr...@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.tayl...@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

 --





 --




-- 





Re: [web2py] Removing labels from forms

2012-08-29 Thread Anthony
On Wednesday, August 29, 2012 1:59:21 PM UTC-4, rochacbruno wrote:

 for label in form.elements('label'): 
 label[_style] = display:none;


And now in trunk:

form.elements('label', replace=None)

That will remove all labels. Actually, you might want to remove the parent 
TD or DIV of each label, so instead, maybe:

form.elements('.w2p_fl', replace=None)

Anthony

-- 





Re: [web2py] Removing labels from forms

2012-08-29 Thread Bruno Rocha
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.tayl...@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 rochacbr...@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.tayl...@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
 
  --
 
 
 
 
 
  --
 
 
 

 --





-- 





Re: [web2py] Removing labels from forms

2012-08-29 Thread Alec Taylor
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 rochacbr...@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.tayl...@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 rochacbr...@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.tayl...@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
 
  --
 
 
 
 
 
  --
 
 
 

 --





 --




-- 





Re: [web2py] Removing labels from forms

2012-08-29 Thread Anthony
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.comjavascript: 
 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.comjavascript: 
 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.comjavascript:
 
  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.comjavascript:
 
   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
  
   --
  
  
  
  
  
   --
  
  
  
 
  --
 
 
 
 
 
  --
   
   
   



--