I already suggest this... But we could make a Field() methode that let
insert HTML attribute to a field like html5 attributes or any other
attribute without the obligation to create a custom widget or manipulate a
generated form, etc.

Ex.:

Field('input', 'type', ..., html_attr=dict('_placeholder'='my place holder
text...'),

The html_attr should be smart and not set wrong attr to a given html tag if
this property is not a member of the tag attributes...

Not sure how it could be done, but it could be really usefull to help
improve form with new html5 attributes...

Thanks

Richard


On Sun, Jul 28, 2013 at 9:05 PM, Anthony <abasta...@gmail.com> wrote:

> No difference between single and double quotes, though you typically use
> single quotes unless you are quoting something that contains single quotes,
> in which case you may use double quotes (or triple single/double quotes --
> ''' or """).
>
> Parentheses are used when calling functions or methods, and brackets are
> used for specifying keys of dictionaries or slicing lists.
>
> All of this is just standard Python, so any Python reference should cover
> this.
>
> Anthony
>
>
> On Sunday, July 28, 2013 2:07:18 PM UTC-4, davedigerati wrote:
>>
>> Thank you Anthony- U nailed it.
>>
>> But can I say GRRRRR!?
>> I had tried that but copy/pasted the lines so the placeholder still had
>> an = to output and I'm guessing that was what it barfed on....
>>
>> Is there a good, short/sweet reference for format of single vs double
>> quotes, parentheses vs brackets?  I notice differences in the answers above
>> and would like to understand convention better.
>> Again, thank you!
>>
>> On Sunday, July 28, 2013 1:56:24 PM UTC-4, Anthony wrote:
>>>
>>> Should be:
>>>
>>> {{form.custom.widget.tm_home["**_placeholder"] = "Home Team Name"}}
>>> {{=form.custom.widget.tm_home}**}
>>>
>>> You can move that first line into the controller if you like.
>>>
>>> Anthony
>>>
>>> On Sunday, July 28, 2013 1:41:22 PM UTC-4, davedigerati wrote:
>>>>
>>>> Been banging my head against the wall with this, trying to move from a
>>>> simple form to a sqlform, and placeholder is not working:
>>>> in my view this works fine:
>>>> {{=form.custom.widget.tm_home}**}
>>>> but
>>>> {{=form.custom.widget.tm_home[**"_placeholder"] = "Home Team Name"}}
>>>> or
>>>> {{=form.custom.widget.tm_home[**'_placeholder] = 'Home Team Name'}}
>>>> gives
>>>> <type 'exceptions.SyntaxError'> keyword can't be an expression
>>>> (newGame.html, line 99)
>>>> and
>>>> {{=form.custom.widget.tm_home(**_placeholder = "Home Team Name")}}
>>>> gives
>>>> <type 'exceptions.TypeError'> 'INPUT' object is not callable
>>>>
>>>> I'm assuming this is a formatting problem in my code (hence the
>>>> variations above I scraped from google and this thread) but what exactly?
>>>> Thanks!
>>>>
>>>> (And +1 for more input attributes)
>>>>
>>>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to