Thanks Anthony, it sounds like a good idea but the browser ends up 
receiving:

data-options="{"mode":"calbox", 
"useNewStyle":true}"

We need to make this easier (let alone work), the newer mobile add-ons/plug-ins 
are using the data attributes a lot.


If anyone else wants to play with this I am trying to use jQueryMobile 
DateBox:
http://dev.jtsage.com/jQM-DateBox2/demos/mode/calbox.html

the basic example requires to build an input field as follows:

<input name="mydate" id="mydate" type="date" data-role="datebox" 
data-options='{"mode": "calbox"}'>

Regards,
Denes




On Saturday, October 26, 2013 9:46:48 AM UTC-4, Anthony wrote:
>
> Attributes are always put in double quotes: 
> https://github.com/web2py/web2py/blob/master/gluon/html.py#L907. I 
> suppose you could manually replace the double quotes after serializing:
>
> input = INPUT(..., data={'options': XML('{"mode":"calbox"}')})
> XML(input.xml().replace('"{', "'{").replace('}"', "}'"))
>
> Anthony
>
> On Friday, October 25, 2013 5:57:48 PM UTC-4, DenesL wrote:
>>
>>
>> using web2py 2.5.1 source on windows
>>
>> Having trouble creating an INPUT with a "non-trivial" data attribute.
>> Did try the following:
>>
>> INPUT(...,**{'_data-options':XML('{"mode":"calbox"}')} )
>>
>> INPUT(..., data={'options':XML('{"mode":"calbox"}')} )
>>
>> and several combinations with raw strings but it always outputs:
>>
>> <input data-options="{"mode":"calbox"}" ... />   which breaks on "{"
>>
>> Single quoted string works fine 
>> data-options="{'mode':'calbox'}"
>> but the code requires double quoted strings. 
>>
>> Bug, or is there a way I am not seeing?.
>>
>> Thanks,
>> Denes
>>
>> P.S. printing what goes on in DIV._xml() produces a lot of output for the 
>> same attributes, inner component redundancy?. 
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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