I have a dropdown, I use to represent the id of the linked table with the
reprensent I wrote... Now the dropdown witdh get pretty large because of
user data that I need to concatenate to make thing clear on what will be
selected... User use to duplicate the unique key of the foreight table
since que id is surrogate and the candidate field for unique key are not
unique I have to make it unique by showing the element to wich the linked
table link to...

Hope you can follow...

But basically I concatenate multiple table relation like this
table1uniquefield/table2uniquefield/etc. None of the table are really
unique until they are associate together so I need to concatenate the
linked row between my differents tables...

So I try to solve my issue by tweaking the display of dropdown menu by
putting on many row the reprensentation... Instead of having :

table1-1/table2/table3-element1 give ID 1 table 3
table1-2/table2/table3-element1 give ID 2 table 3
table1-3/table3/table3-element2 give ID 3 table 3

I want to have in my dropdown :

table1-1/
table2/
table3-element1 give ID 1 table 3
table1-2/
table2/
table3-element1 give ID 2 table 3
table1-3/
table3/
table3-element2 give ID 3 table 3

Pretty awful I know...

I will try other solution latter jQuery UI Autocomplet...

Richard

On Thu, Nov 10, 2011 at 12:19 PM, Anthony <[email protected]> wrote:

> I don't understand -- where is that ul supposed to go? What field are your
> representing? What is the "default navigator drop box"?
>
>
> On Thursday, November 10, 2011 12:03:27 PM UTC-5, Richard wrote:
>
>> Workin in console :
>>
>>
>> In [1]: test123 = 'test/test2/test3/'
>>
>> In [2]: test123
>> Out[2]: 'test/test2/test3/'
>>
>> In [3]: for v in test123.split('/'):
>>    ...:     if v != '':
>>    ...:         v
>>    ...:
>>    ...:
>> Out[3]: 'test'
>> Out[3]: 'test2'
>> Out[3]: 'test3'
>>
>> In [4]: XML(UL(*[ LI(v) for v in test123.split('/') if v != '' ]))
>> Out[4]: <gluon.html.XML object at 0x26ec550>
>>
>> In [5]: print XML(UL(*[ LI(v) for v in test123.split('/') if v != '' ]))
>> <ul><li>test</li><li>test2</**li><li>test3</li></ul>
>>
>> But in generated view I only get the default option no ul or li...
>>
>> Thanks
>>
>> Richard
>>
>> On Thu, Nov 10, 2011 at 12:01 PM, Richard Vézina 
>> <[email protected]>wrote:
>>
>>> Hello Anthony,
>>>
>>> I am trying to do something bizzard... I would like to have your advice
>>> if it's even possible :
>>>
>>> represent=lambda value, row: (value!=None and XML(UL(*[ LI(v) for v in
>>> value.split('/') if v != '' ]))) or 'None'
>>>
>>> I would like the default navigator drop box to display html stuff is
>>> this possible?
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>>
>>> On Thu, Nov 10, 2011 at 8:07 AM, Anthony <[email protected]> wrote:
>>>
>>>> On Thursday, November 10, 2011 7:58:57 AM UTC-5, peter wrote:
>>>>>
>>>>> I have a couple of problems with 'text' fields in databases. I want to
>>>>> be able to use a WYSIWIG editor, so I have set up ckeditor using the
>>>>> instructions here
>>>>>
>>>>> http://www.web2pyslices.com/**sl**ices/take_slice/18<http://www.web2pyslices.com/slices/take_slice/18>
>>>>>
>>>>> This works fine, but there is no toolbar appearing with the editor.
>>>>> How does one get the basic toolbar to appear?
>>>>>
>>>>
>>>> You have to set the CKEditor options -- see it's documentation: http://
>>>> **ckeditor.com/ <http://ckeditor.com/>
>>>>
>>>>
>>>>>
>>>>> If I succeed in getting this working and can embolden text etc. How do
>>>>> I convert the text to html that reflects this emboldening?
>>>>>
>>>>
>>>> You won't be converting text to HTML -- CKEditor itself generates HTML,
>>>> which is what will get saved in the associated text field in the DB. The
>>>> trick is how to get the HTML to display properly when you pull it from the
>>>> DB and include it in the view. By default, web2py will escape the HTML, so
>>>> it won't display as intended. To avoid that, use the XML() helper -- in the
>>>> view, {{=XML(your_html_content)}}. Though this is dangerous if you are
>>>> allowing users to enter the HTML because they can insert malicious
>>>> Javascript. In that case, use {{=XML(your_html_content,
>>>> sanitize=True)}}, though that will limit the allowed HTML tags and
>>>> attributes. See 
>>>> http://web2py.com/book/**default/chapter/05#XML<http://web2py.com/book/default/chapter/05#XML>
>>>> .
>>>>
>>>> Anthony
>>>>
>>>
>>>
>>

Reply via email to