Dear All
Thank you Oliver for your detailed advice. I can now retrieve data into the 
dropdownlist, although i did not construct a new plug in: wrote an external php 
function to retrieve item names from database which i call from ClientEdit 
renderform function in edit plugin. My question related to this is: How do i 
use this function instead from the Server side so i can take advantage of the 
already constructed dsn? ( i now have to make another connection to database.)
Do i need this? I didnt use it and it works!   /*<![CDATA[*/       
.........................            /*]]>*/
Broun Uganda


From: [EMAIL PROTECTED]: [EMAIL PROTECTED]; [EMAIL PROTECTED]: Re: 
[Cartoweb-users] How to use dropdownlist with data from databaseDate: Thu, 13 
Sep 2007 10:29:25 +0200



Hi
 
do it in two phase.
 
first make a plugin that will return the list of values for the select.
but instead of producing html, simply output a string with the values separated 
by comma, like this: 
option1,option2, option3, ... 
if the option name is different from the option value, simply generate two 
string
you do this in the renderform function of your plugin, by setting, for example 
$optionNamesList = 'option1name,option2name,...' and $optionValuesList = 
'option1value,...'
 
and in your template, add this somewhere:
 
<script type="text/javascript">  /*<![CDATA[*/    var optionNamesList = 
'{$optionNamesList}';
    var optionValuesList = '{$optionValuesList}';  /*]]>*/</script>
 
this way to can access the options data via the edit plugin javascript
 
the edit plugin javascript is complex, maybe ask someone who know javascript to 
help you with that part
 
In the actual HowToAddDropdownInEditPlugin example, the options data is written 
in hard in the code. All you have to do is, instead, get the optionNamesList 
and optionValuesList javascript variable (defined in the template, see above).
 
so, instead of using 
var authorisedOptionsList = new array( ...
var authorisedOptionsListLabel = new array( ...
 
you use
var authorisedOptionsList = optionValuesList.split(",");
var authorisedOptionsListLabel = optionNamesList.split(",");
 
this convert the string provided by your other plugin into an array of options 
label and value the javascript from the edit plugin can use.
 
regards
Oliver

Hey all,If i want to use the example given in the wiki for retrieving data from 
server (http://cartoweb.org/cwiki/HowToReturnDataFromServerToClient), but i 
want to return this data list to the javascript that constructs an edit table 
(in edit plugin), how would i do that? I want to combine the above HowTo and 
the dropdownlist(http://cartoweb.org/cwiki/HowToAddDropdownInEditPlugin) 
HowTo.Am not a pro in these things (javascripts, php)ThanksBroun Uganda

Get news, entertainment and everything you care about at Live.com. Check it 
out! 



_______________________________________________Cartoweb-users mailing [EMAIL 
PROTECTED]://lists.maptools.org/mailman/listinfo/cartoweb-users
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx
_______________________________________________
Cartoweb-users mailing list
Cartoweb-users@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/cartoweb-users

Reply via email to