[Cartoweb-users] Populate aselect from db

Oliver Christen oliver.christen at camptocamp.com
Fri Jun 6 08:21:55 EDT 2008


yes, the idea is to set javascript variables using smarty.

you define a smarty variable with the data that will be used to fill the 
select

in a template, you use something like this:
<script type="text/javascript">
  /*<![CDATA[*/
    var values_of_select_1 = '{$the_corresponding_smarty_variable_1}';
    var values_of_select_2 = '{$the_corresponding_smarty_variable_2}';
  /*]]>*/
</script>

and in the edit plugin javascript, you get these variable values and fill 
the select with them.

regards
Oliver

>I think you could do this working on .tpl file associated to your 
>user-interface (from which user can choose values...)
>
> Giovanni Virdis ha scritto:
>>
>> Hi,
>>
>> if is possibile i want populate the select item from db. I have modify 
>> the dhtmlEdit.js file to show a select item with a fix value
>>
>>
>> var authorisedOptionsList = new Array(1, 2, 3);
>>
>> var authorisedOptionsListLabel = new Array('Strutture pubbliche', 
>> 'Strutture per il commercio', 'Strutture militari');
>>
>>
>> How i can populate this item  by db select?
>>
>>  Is possible chanche the value of second select item when I change the 
>> value of first select item ?
>>
>> Example
>>
>>
>> 1° Select value:
>>
>>
>> 1, 'America'
>> 2, 'Europa'
>>
>> 3, 'Asia'
>>
>> 4, 'Oceania'
>>
>> 5, 'Africa'
>>
>>
>> 2° Select value:
>>
>>
>> 1, 'Giappone'
>> 2, 'Cina'
>> 3, 'Mongolia'
>> 4, 'Stati Uniti'
>> 5, 'Canada'
>> 6, 'Messico'
>> 7, 'Italia'
>> 8, 'Spagna'
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Cartoweb-users mailing list
>> Cartoweb-users at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>>
>
> -- 
> Ing. Fabio D'Ovidio
>
> INOVA Open Solutions s.r.l.
> Web : http://www.inovaos.it
> Tel.: 081 197 57 600
> mail: fabiodovidio at gmail.com
>
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users
> 



More information about the Cartoweb-users mailing list