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