Have you tried simplejson.dump()?

On Tuesday, February 11, 2014 12:52:28 PM UTC-5, Jim S wrote:
>
> Thanks Anthony.  Trying this but running into a problem generating the 
> json to use for the data.  Keep getting a javascript error:
>
> SyntaxError:  invalid property id
>
> data: [{"text": "Skygsslo Farms", "descriptio
>
>
>
> On the python side I'm building it like this:
>
>         for customer in 
> db(customerQuery).select(orderby=db.customer.customerId):
>             customerList.append(dict(value=customer.customerId,
>                                      text=customer.name,
>                                      description='%s, %s' % 
> (customer.city,customer.state)))
>
>       customerList = response.json(customerList)
>
> then I'm passing {{=customerList}} to the data argument in the javascript. 
>  I'm not well-versed enough in javascript/json to know how to get rid of 
> these quotes, and even if I do, will it help?
>
> Any insight would be appreciated.  Or, tell me to work it out on my own....
>
> -Jim
>
>
> On Tue, Feb 11, 2014 at 10:07 AM, Anthony <abas...@gmail.com <javascript:>
> > wrote:
>
>> I don't think you can put any additional HTML tags in an <option> 
>> element, so you would probably have to use a Javascript plugin to render a 
>> custom dropdown (e.g., http://designwithpc.com/Plugins/ddSlick).
>>
>> Anthony
>>
>>
>> On Tuesday, February 11, 2014 10:57:00 AM UTC-5, Jim S wrote:
>>>
>>> I'm looking for a way to format the dropdown list generated from a 
>>> SQLFORM.
>>>
>>> I'm using the following code:
>>>
>>> db.equipOrder.customerId.requires = IS_IN_DB(query, db.customer, 
>>> ('%(customerId)s - %(name)s'), zero='..')
>>>
>>> which give me a nice dropdown list showing my customer id and name. 
>>>  However, I'd really like to add a second line to each item in my list that 
>>> displays the city and state where the customer reside.  Is there a way for 
>>> me to do this using the IS_IN_DB validator?
>>>
>>> -Jim
>>>
>>>  -- 
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/dx_PQybY4MI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

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