Loading ...
Sorry, an error occurred while loading the content.

populate a carto.net selectionList

Expand Messages
  • pascal.benoist
    Hello, I just developpe a little query builder for my svg application and i use SelectionLists from carto.net I would like to populate automatically a
    Message 1 of 8 , Aug 1, 2006
    • 0 Attachment
      Hello,

      I just developpe a little query builder for my svg application and i
      use SelectionLists from carto.net

      I would like to populate automatically a selectionList from the
      choice made in a preceding selectionList.
      First, I create 2 selectionLists (selectionList1 and selectionList2)
      The first one is populated directly at the creation.
      The second one is first populated with a empty array.

      I choose a value in SelectionList1
      Then , I run a PHP script with this parameter, request my DB (I
      request :
      DESCRIBE <MyTable> ) with <MyTable> the item selected in
      selectionList1 Then, I would like to automatically populate
      selectionList2 with the values return from the request (those values
      are the Fields of <MyTable>)

      Would you have any tutorial that explain that?

      Secondly, I cannot understand why the above Javascript code does not
      work :
      function updateSelectionList
      selectionListName,selectedIndex,selectedValue)
      {
      // reinitialisation de selectionListDynLayer
      position = 0;
      while
      (selectionListDynLayer.selectElementByPosition(position,false)) {
      MyAlert("deleting element position " + position
      + " : " + selectionListDynLayer.getCurrentSelectionElement());

      selectionListDynLayer.deleteElement
      (selectionListDynLayer.getCurrentSelectio
      nElement());
      position++;
      }

      MyAlert("selected : " + selectedValue);
      selectionListArray = new
      Array(getSelectionListArray(selectedValue));

      MyAlert("selectionListArray : " + selectionListArray);
      for (i=0;i<selectionListArray.length;i++) {
      selectionListDynLayer.addElementAtPosition(selectionListArray
      [i],i);
      }
      }

      function getSelectionListArray(MyTable) {
      PHPFileName = "../files/getSelectionListArray.php?MyTable="
      + MyTable;
      getDataObjSelectionListArray.url=PHPFileName;
      getDataObjSelectionListArray.getData();
      }

      function callbackSelectionListArray(theNode) {
      MyAlert("callback:" + printNode(theNode));
      return theNode; // not sure it is a good idea ...
      }

      Thanks
    • Andreas Neumann
      HI Pascal, its actually easier than that. You don t need to remove and add individual elements, you can simply replace the property .elementsArray of the
      Message 2 of 8 , Aug 2, 2006
      • 0 Attachment
        HI Pascal,

        its actually easier than that. You don't need to remove and add
        individual elements, you can simply replace the property
        ".elementsArray" of the second selectionList, e.g.
        -------
        selectionList2.elementsArray = newArray;
        selectionList2.selectElementByPosition(0,false);
        -------

        note that I propose to also call the method
        .selectElementByPosition() to make sure that the second
        selectionlist now displays a valid value of the new array.

        As an example see http://www.carto.net/papers/svg/gui/selectionlist/
        index.svg

        see the two selectionlists at the upper right.

        See http://www.carto.net/papers/svg/gui/selectionlist/init.js and the
        function "updateNumbers2" to see how I set the new values.

        you can query a new array from the database on the server using a
        network request (XMLHttpRequest and getURL).

        The same also works for comboboxes: see http://www.carto.net/williams/
        yosemite/, go to the "Search" tab and enter something in the texbox.
        As you type the values in the combobox are populated with the results
        of a database query.

        Hope this helps,
        Andreas

        --- In svg-developers@yahoogroups.com,
        "pascal.benoist" <pascal.benoist11@...> wrote:
        >
        > Hello,
        >
        > I just developpe a little query builder for my svg application and
        i
        > use SelectionLists from carto.net
        >
        > I would like to populate automatically a selectionList from the
        > choice made in a preceding selectionList.
        > First, I create 2 selectionLists (selectionList1 and
        selectionList2)
        > The first one is populated directly at the creation.
        > The second one is first populated with a empty array.
        >
        > I choose a value in SelectionList1
        > Then , I run a PHP script with this parameter, request my DB (I
        > request :
        > DESCRIBE <MyTable> ) with <MyTable> the item selected in
        > selectionList1 Then, I would like to automatically populate
        > selectionList2 with the values return from the request (those
        values
        > are the Fields of <MyTable>)
        >
        > Would you have any tutorial that explain that?
        >
        > Secondly, I cannot understand why the above Javascript code does
        not
        > work :
        > function updateSelectionList
        > selectionListName,selectedIndex,selectedValue)
        > {
        > // reinitialisation de selectionListDynLayer
        > position = 0;
        > while
        > (selectionListDynLayer.selectElementByPosition(position,false)) {
        > MyAlert("deleting element position " + position
        > + " : " + selectionListDynLayer.getCurrentSelectionElement());
        >
        > selectionListDynLayer.deleteElement
        > (selectionListDynLayer.getCurrentSelectio
        > nElement());
        > position++;
        > }
        >
        > MyAlert("selected : " + selectedValue);
        > selectionListArray = new
        > Array(getSelectionListArray(selectedValue));
        >
        > MyAlert("selectionListArray : " + selectionListArray);
        > for (i=0;i<selectionListArray.length;i++) {
        > selectionListDynLayer.addElementAtPosition(selectionListArray
        > [i],i);
        > }
        > }
        >
        > function getSelectionListArray(MyTable) {
        > PHPFileName = "../files/getSelectionListArray.php?MyTable="
        > + MyTable;
        > getDataObjSelectionListArray.url=PHPFileName;
        > getDataObjSelectionListArray.getData();
        > }
        >
        > function callbackSelectionListArray(theNode) {
        > MyAlert("callback:" + printNode(theNode));
        > return theNode; // not sure it is a good idea ...
        > }
        >
        > Thanks
        >
      • Pascal BENOIST
        Hi Andreas, Thanks a lot for your answer, Its ok for the update of the list. My problem in fact is to obtain the node from the url or XMLHttpRequest when you
        Message 3 of 8 , Aug 3, 2006
        • 0 Attachment
          Hi Andreas,



          Thanks a lot for your answer,

          Its ok for the update of the list.

          My problem in fact is to obtain the node from the url or XMLHttpRequest when
          you say:

          “you can query a new array from the database on the server using a
          network request (XMLHttpRequest and getURL).”

          I would like to use the same fonctions that I use to retrieve geometry (I
          already use helpers_functions.js for that).

          I don’t know how to retrieve data that is not <g> or that is not XML like an
          array of elements…

          Am I obliged to integrate it in a <g> element in my svg before to use it
          through a js script?

          Pascal BENOIST
          Mob: +33 (0)6 12 61 68 02
          Fixe: +33 (0)4 50 75 17 74

          _____

          De : svg-developers@yahoogroups.com [mailto:svg-developers@yahoogroups.com]
          De la part de Andreas Neumann
          Envoyé : mercredi 2 août 2006 15:53
          À : svg-developers@yahoogroups.com
          Objet : [svg-developers] Re: populate a carto.net selectionList



          HI Pascal,

          its actually easier than that. You don't need to remove and add
          individual elements, you can simply replace the property
          ".elementsArray" of the second selectionList, e.g.
          -------
          selectionList2.elementsArray = newArray;
          selectionList2.selectElementByPosition(0,false);
          -------

          note that I propose to also call the method
          .selectElementByPosition() to make sure that the second
          selectionlist now displays a valid value of the new array.

          As an example see http://www.carto
          <http://www.carto.net/papers/svg/gui/selectionlist/>
          net/papers/svg/gui/selectionlist/
          index.svg

          see the two selectionlists at the upper right.

          See http://www.carto
          <http://www.carto.net/papers/svg/gui/selectionlist/init.js>
          net/papers/svg/gui/selectionlist/init.js and the
          function "updateNumbers2" to see how I set the new values.

          you can query a new array from the database on the server using a
          network request (XMLHttpRequest and getURL).

          The same also works for comboboxes: see http://www.carto
          <http://www.carto.net/williams/> net/williams/
          yosemite/, go to the "Search" tab and enter something in the texbox.
          As you type the values in the combobox are populated with the results
          of a database query.

          Hope this helps,
          Andreas

          --- In svg-developers@ <mailto:svg-developers%40yahoogroups.com>
          yahoogroups.com,
          "pascal.benoist" <pascal.benoist11@...> wrote:
          >
          > Hello,
          >
          > I just developpe a little query builder for my svg application and
          i
          > use SelectionLists from carto.net
          >
          > I would like to populate automatically a selectionList from the
          > choice made in a preceding selectionList.
          > First, I create 2 selectionLists (selectionList1 and
          selectionList2)
          > The first one is populated directly at the creation.
          > The second one is first populated with a empty array.
          >
          > I choose a value in SelectionList1
          > Then , I run a PHP script with this parameter, request my DB (I
          > request :
          > DESCRIBE <MyTable> ) with <MyTable> the item selected in
          > selectionList1 Then, I would like to automatically populate
          > selectionList2 with the values return from the request (those
          values
          > are the Fields of <MyTable>)
          >
          > Would you have any tutorial that explain that?
          >
          > Secondly, I cannot understand why the above Javascript code does
          not
          > work :
          > function updateSelectionList
          > selectionListName,selectedIndex,selectedValue)
          > {
          > // reinitialisation de selectionListDynLayer
          > position = 0;
          > while
          > (selectionListDynLayer.selectElementByPosition(position,false)) {
          > MyAlert("deleting element position " + position
          > + " : " + selectionListDynLayer.getCurrentSelectionElement());
          >
          > selectionListDynLayer.deleteElement
          > (selectionListDynLayer.getCurrentSelectio
          > nElement());
          > position++;
          > }
          >
          > MyAlert("selected : " + selectedValue);
          > selectionListArray = new
          > Array(getSelectionListArray(selectedValue));
          >
          > MyAlert("selectionListArray : " + selectionListArray);
          > for (i=0;i<selectionListArray.length;i++) {
          > selectionListDynLayer.addElementAtPosition(selectionListArray
          > [i],i);
          > }
          > }
          >
          > function getSelectionListArray(MyTable) {
          > PHPFileName = "../files/getSelectionListArray.php?MyTable="
          > + MyTable;
          > getDataObjSelectionListArray.url=PHPFileName;
          > getDataObjSelectionListArray.getData();
          > }
          >
          > function callbackSelectionListArray(theNode) {
          > MyAlert("callback:" + printNode(theNode));
          > return theNode; // not sure it is a good idea ...
          > }
          >
          > Thanks
          >



          ----------------------------------------------------------------------------
          -----------
          Orange vous informe que cet e-mail a été contrôlé par l'anti-virus mail.
          Aucun virus connu à ce jour par nos services n'a été détecté.





          [Non-text portions of this message have been removed]
        • Andreas Neumann
          Hi Pascal, you can use the json format for that purpose, which is basically javascript code generated dynamically on the server and sent to the client as text.
          Message 4 of 8 , Aug 3, 2006
          • 0 Attachment
            Hi Pascal,

            you can use the json format for that purpose, which is basically javascript code generated
            dynamically on the server and sent to the client as text. The client receives the text string
            and can use with eval(textstring) or a function to interpret the javascript code.

            I haven't documented it yet, but here is a wrapper function for getURL/XMLHttpRequest
            that allows to either retrieve an XML node or text to be used with eval().

            http://www.carto.net/williams/yosemite/helper_functions.js

            have a look at the getData object. Note that his object is slightly different from the original
            getXMLData object. It allows for a third parameter that can have the values "xml" or "json"

            in http://www.carto.net/williams/yosemite/search.js
            have a look at the method "searchObject.prototype.receiveData" which receives the json
            text and returns the javascript array through a function.

            You can use the variable myResults as an array to populate the selectionList

            Here is an example server request that returns a json array:

            http://www.carto.net/williams/yosemite/sendNameData.php?
            searchstring=Half&searchtype=starts
            with&offset=0&limit=10&xmin=244000&ymin=4150000&xmax=308000&ymax=423100
            0&filterByMapExtent=false

            I plan to document these XML/JSON network requests in a tutorial on carto.net but am
            currently busy. Will take a bit of time until it is available ...

            Hope this helps a bit,
            Andreas

            --- In svg-developers@yahoogroups.com, "Pascal BENOIST" <pascal.benoist11@...>
            wrote:
            >
            > Hi Andreas,
            >
            >
            >
            > Thanks a lot for your answer,
            >
            > Its ok for the update of the list.
            >
            > My problem in fact is to obtain the node from the url or XMLHttpRequest when
            > you say:
            >
            > �you can query a new array from the database on the server using a
            > network request (XMLHttpRequest and getURL).�
            >
            > I would like to use the same fonctions that I use to retrieve geometry (I
            > already use helpers_functions.js for that).
            >
            > I don�t know how to retrieve data that is not <g> or that is not XML like an
            > array of elements�
            >
            > Am I obliged to integrate it in a <g> element in my svg before to use it
            > through a js script?
            >
            > Pascal BENOIST
            > Mob: +33 (0)6 12 61 68 02
            > Fixe: +33 (0)4 50 75 17 74
            >
            > _____
            >
            > De : svg-developers@yahoogroups.com [mailto:svg-developers@yahoogroups.com]
            > De la part de Andreas Neumann
            > Envoy� : mercredi 2 ao�t 2006 15:53
            > � : svg-developers@yahoogroups.com
            > Objet : [svg-developers] Re: populate a carto.net selectionList
            >
            >
            >
            > HI Pascal,
            >
            > its actually easier than that. You don't need to remove and add
            > individual elements, you can simply replace the property
            > ".elementsArray" of the second selectionList, e.g.
            > -------
            > selectionList2.elementsArray = newArray;
            > selectionList2.selectElementByPosition(0,false);
            > -------
            >
            > note that I propose to also call the method
            > .selectElementByPosition() to make sure that the second
            > selectionlist now displays a valid value of the new array.
            >
            > As an example see http://www.carto
            > <http://www.carto.net/papers/svg/gui/selectionlist/>
            > net/papers/svg/gui/selectionlist/
            > index.svg
            >
            > see the two selectionlists at the upper right.
            >
            > See http://www.carto
            > <http://www.carto.net/papers/svg/gui/selectionlist/init.js>
            > net/papers/svg/gui/selectionlist/init.js and the
            > function "updateNumbers2" to see how I set the new values.
            >
            > you can query a new array from the database on the server using a
            > network request (XMLHttpRequest and getURL).
            >
            > The same also works for comboboxes: see http://www.carto
            > <http://www.carto.net/williams/> net/williams/
            > yosemite/, go to the "Search" tab and enter something in the texbox.
            > As you type the values in the combobox are populated with the results
            > of a database query.
            >
            > Hope this helps,
            > Andreas
            >
            > --- In svg-developers@ <mailto:svg-developers%40yahoogroups.com>
            > yahoogroups.com,
            > "pascal.benoist" <pascal.benoist11@> wrote:
            > >
            > > Hello,
            > >
            > > I just developpe a little query builder for my svg application and
            > i
            > > use SelectionLists from carto.net
            > >
            > > I would like to populate automatically a selectionList from the
            > > choice made in a preceding selectionList.
            > > First, I create 2 selectionLists (selectionList1 and
            > selectionList2)
            > > The first one is populated directly at the creation.
            > > The second one is first populated with a empty array.
            > >
            > > I choose a value in SelectionList1
            > > Then , I run a PHP script with this parameter, request my DB (I
            > > request :
            > > DESCRIBE <MyTable> ) with <MyTable> the item selected in
            > > selectionList1 Then, I would like to automatically populate
            > > selectionList2 with the values return from the request (those
            > values
            > > are the Fields of <MyTable>)
            > >
            > > Would you have any tutorial that explain that?
            > >
            > > Secondly, I cannot understand why the above Javascript code does
            > not
            > > work :
            > > function updateSelectionList
            > > selectionListName,selectedIndex,selectedValue)
            > > {
            > > // reinitialisation de selectionListDynLayer
            > > position = 0;
            > > while
            > > (selectionListDynLayer.selectElementByPosition(position,false)) {
            > > MyAlert("deleting element position " + position
            > > + " : " + selectionListDynLayer.getCurrentSelectionElement());
            > >
            > > selectionListDynLayer.deleteElement
            > > (selectionListDynLayer.getCurrentSelectio
            > > nElement());
            > > position++;
            > > }
            > >
            > > MyAlert("selected : " + selectedValue);
            > > selectionListArray = new
            > > Array(getSelectionListArray(selectedValue));
            > >
            > > MyAlert("selectionListArray : " + selectionListArray);
            > > for (i=0;i<selectionListArray.length;i++) {
            > > selectionListDynLayer.addElementAtPosition(selectionListArray
            > > [i],i);
            > > }
            > > }
            > >
            > > function getSelectionListArray(MyTable) {
            > > PHPFileName = "../files/getSelectionListArray.php?MyTable="
            > > + MyTable;
            > > getDataObjSelectionListArray.url=PHPFileName;
            > > getDataObjSelectionListArray.getData();
            > > }
            > >
            > > function callbackSelectionListArray(theNode) {
            > > MyAlert("callback:" + printNode(theNode));
            > > return theNode; // not sure it is a good idea ...
            > > }
            > >
            > > Thanks
            > >
            >
            >
            >
            >
            ----------------------------------------------------------------------------
            > -----------
            > Orange vous informe que cet e-mail a �t� contr�l� par l'anti-virus mail.
            > Aucun virus connu � ce jour par nos services n'a �t� d�tect�.
            >
            >
            >
            >
            >
            > [Non-text portions of this message have been removed]
            >
          • Pascal BENOIST
            Hi Andreas and thanks. I said myself “ I’m sure there is a solution like XMLHttpRequest to retrieve non geometrical data”. Effectively, json seems to be
            Message 5 of 8 , Aug 4, 2006
            • 0 Attachment
              Hi Andreas and thanks.

              I said myself “ I’m sure there is a solution like XMLHttpRequest to retrieve
              non geometrical data”.

              Effectively, json seems to be the solution and i will try to implement it…



              I succeeded yesterday to do it with a slightly different way :

              I make a (valid: thanks <g) xml node like this in my php script :



              echo ‘<g myArray= ‘’’ . $string . ‘’’/>’ . ‘’\n’’;



              with $string being the response of mySQL DB like this :



              $string = ‘’;

              $sep = ‘’;

              while ($descTable = mysql_fetch_array($result) {

              $string .= $sep . $descTable[‘Field’];

              $sep = ‘,’;

              }

              // the request was “DESCRIBE <table>”



              Then, in my callback js function, i decode the string as :

              var listeString =
              printNode(theNode).substring(12,printNode(theNode).length-3);

              var listeArray = listeString.split(“,”);

              …



              Its not very elegant but it works and i use it to populate automatically my
              different selection lists regarding the selected value of the preceeding
              one.



              The only thing that do not work (if not called from my callback) function is
              this :

              mySelectionListe.selectElementByPosition(17,false);



              I wanted to update the index afterward, in my main svg object…

              Pascal BENOIST
              Mob: +33 (0)6 12 61 68 02
              Fixe: +33 (0)4 50 75 17 74

              _____

              De : svg-developers@yahoogroups.com [mailto:svg-developers@yahoogroups.com]
              De la part de Andreas Neumann
              Envoyé : jeudi 3 août 2006 23:37
              À : svg-developers@yahoogroups.com
              Objet : [svg-developers] Re: populate a carto.net selectionList



              Hi Pascal,

              you can use the json format for that purpose, which is basically javascript
              code generated
              dynamically on the server and sent to the client as text. The client
              receives the text string
              and can use with eval(textstring) or a function to interpret the javascript
              code.

              I haven't documented it yet, but here is a wrapper function for
              getURL/XMLHttpRequest
              that allows to either retrieve an XML node or text to be used with eval().

              http://www.carto
              <http://www.carto.net/williams/yosemite/helper_functions.js>
              net/williams/yosemite/helper_functions.js

              have a look at the getData object. Note that his object is slightly
              different from the original
              getXMLData object. It allows for a third parameter that can have the values
              "xml" or "json"

              in http://www.carto <http://www.carto.net/williams/yosemite/search.js>
              net/williams/yosemite/search.js
              have a look at the method "searchObject.prototype.receiveData" which
              receives the json
              text and returns the javascript array through a function.

              You can use the variable myResults as an array to populate the selectionList

              Here is an example server request that returns a json array:

              http://www.carto <http://www.carto.net/williams/yosemite/sendNameData.php?>
              net/williams/yosemite/sendNameData.php?
              searchstring=Half&searchtype=starts
              with&offset=0&limit=10&xmin=244000&ymin=4150000&xmax=308000&ymax=423100
              0&filterByMapExtent=false

              I plan to document these XML/JSON network requests in a tutorial on
              carto.net but am
              currently busy. Will take a bit of time until it is available ...

              Hope this helps a bit,
              Andreas

              --- In svg-developers@ <mailto:svg-developers%40yahoogroups.com>
              yahoogroups.com, "Pascal BENOIST" <pascal.benoist11@...>
              wrote:
              >
              > Hi Andreas,
              >
              >
              >
              > Thanks a lot for your answer,
              >
              > Its ok for the update of the list.
              >
              > My problem in fact is to obtain the node from the url or XMLHttpRequest
              when
              > you say:
              >
              > �you can query a new array from the database on the server using a
              > network request (XMLHttpRequest and getURL).�
              >
              > I would like to use the same fonctions that I use to retrieve geometry (I
              > already use helpers_functions.js for that).
              >
              > I don�t know how to retrieve data that is not <g> or that is not XML
              like an
              > array of elements�
              >
              > Am I obliged to integrate it in a <g> element in my svg before to use it
              > through a js script?
              >
              > Pascal BENOIST
              > Mob: +33 (0)6 12 61 68 02
              > Fixe: +33 (0)4 50 75 17 74
              >
              > _____
              >
              > De : svg-developers@ <mailto:svg-developers%40yahoogroups.com>
              yahoogroups.com [mailto:svg-developers@
              <mailto:svg-developers%40yahoogroups.com> yahoogroups.com]
              > De la part de Andreas Neumann
              > Envoy� : mercredi 2 ao�t 2006 15:53
              > � : svg-developers@ <mailto:svg-developers%40yahoogroups.com>
              yahoogroups.com
              > Objet : [svg-developers] Re: populate a carto.net selectionList
              >
              >
              >
              > HI Pascal,
              >
              > its actually easier than that. You don't need to remove and add
              > individual elements, you can simply replace the property
              > ".elementsArray" of the second selectionList, e.g.
              > -------
              > selectionList2.elementsArray = newArray;
              > selectionList2.selectElementByPosition(0,false);
              > -------
              >
              > note that I propose to also call the method
              > .selectElementByPosition() to make sure that the second
              > selectionlist now displays a valid value of the new array.
              >
              > As an example see http://www.carto
              > <http://www.carto <http://www.carto.net/papers/svg/gui/selectionlist/>
              net/papers/svg/gui/selectionlist/>
              > net/papers/svg/gui/selectionlist/
              > index.svg
              >
              > see the two selectionlists at the upper right.
              >
              > See http://www.carto
              > <http://www.carto
              <http://www.carto.net/papers/svg/gui/selectionlist/init.js>
              net/papers/svg/gui/selectionlist/init.js>
              > net/papers/svg/gui/selectionlist/init.js and the
              > function "updateNumbers2" to see how I set the new values.
              >
              > you can query a new array from the database on the server using a
              > network request (XMLHttpRequest and getURL).
              >
              > The same also works for comboboxes: see http://www.carto
              > <http://www.carto <http://www.carto.net/williams/> net/williams/>
              net/williams/
              > yosemite/, go to the "Search" tab and enter something in the texbox.
              > As you type the values in the combobox are populated with the results
              > of a database query.
              >
              > Hope this helps,
              > Andreas
              >
              > --- In svg-developers@ <mailto:svg-developers%40yahoogroups.com>
              > yahoogroups.com,
              > "pascal.benoist" <pascal.benoist11@> wrote:
              > >
              > > Hello,
              > >
              > > I just developpe a little query builder for my svg application and
              > i
              > > use SelectionLists from carto.net
              > >
              > > I would like to populate automatically a selectionList from the
              > > choice made in a preceding selectionList.
              > > First, I create 2 selectionLists (selectionList1 and
              > selectionList2)
              > > The first one is populated directly at the creation.
              > > The second one is first populated with a empty array.
              > >
              > > I choose a value in SelectionList1
              > > Then , I run a PHP script with this parameter, request my DB (I
              > > request :
              > > DESCRIBE <MyTable> ) with <MyTable> the item selected in
              > > selectionList1 Then, I would like to automatically populate
              > > selectionList2 with the values return from the request (those
              > values
              > > are the Fields of <MyTable>)
              > >
              > > Would you have any tutorial that explain that?
              > >
              > > Secondly, I cannot understand why the above Javascript code does
              > not
              > > work :
              > > function updateSelectionList
              > > selectionListName,selectedIndex,selectedValue)
              > > {
              > > // reinitialisation de selectionListDynLayer
              > > position = 0;
              > > while
              > > (selectionListDynLayer.selectElementByPosition(position,false)) {
              > > MyAlert("deleting element position " + position
              > > + " : " + selectionListDynLayer.getCurrentSelectionElement());
              > >
              > > selectionListDynLayer.deleteElement
              > > (selectionListDynLayer.getCurrentSelectio
              > > nElement());
              > > position++;
              > > }
              > >
              > > MyAlert("selected : " + selectedValue);
              > > selectionListArray = new
              > > Array(getSelectionListArray(selectedValue));
              > >
              > > MyAlert("selectionListArray : " + selectionListArray);
              > > for (i=0;i<selectionListArray.length;i++) {
              > > selectionListDynLayer.addElementAtPosition(selectionListArray
              > > [i],i);
              > > }
              > > }
              > >
              > > function getSelectionListArray(MyTable) {
              > > PHPFileName = "../files/getSelectionListArray.php?MyTable="
              > > + MyTable;
              > > getDataObjSelectionListArray.url=PHPFileName;
              > > getDataObjSelectionListArray.getData();
              > > }
              > >
              > > function callbackSelectionListArray(theNode) {
              > > MyAlert("callback:" + printNode(theNode));
              > > return theNode; // not sure it is a good idea ...
              > > }
              > >
              > > Thanks
              > >
              >
              >
              >
              >
              ----------------------------------------------------------
              > -----------
              > Orange vous informe que cet e-mail a �t� contr�l� par l'anti-virus
              mail.
              > Aucun virus connu � ce jour par nos services n'a �t� d�tect�.
              >
              >
              >
              >
              >
              > [Non-text portions of this message have been removed]
              >



              ----------------------------------------------------------------------------
              -----------
              Orange vous informe que cet e-mail a été contrôlé par l'anti-virus mail.
              Aucun virus connu à ce jour par nos services n'a été détecté.





              [Non-text portions of this message have been removed]
            • Pascal BENOIST
              Hi Andreas, In a way to have a better comprehension of JSON principles, could you send me the php file that write the json code (like sendNameData.php) ?
              Message 6 of 8 , Sep 12, 2006
              • 0 Attachment
                Hi Andreas,



                In a way to have a better comprehension of JSON principles, could you send
                me the php file that write the json code (like sendNameData.php) ?



                Pascal BENOIST
                pascal.benoist11@...
                Mob: +33 (0)6 12 61 68 02
                Fixe: +33 (0)4 50 75 17 74

                _____

                De : svg-developers@yahoogroups.com [mailto:svg-developers@yahoogroups.com]
                De la part de Andreas Neumann
                Envoyé : jeudi 3 août 2006 23:37
                À : svg-developers@yahoogroups.com
                Objet : [svg-developers] Re: populate a carto.net selectionList



                Hi Pascal,

                you can use the json format for that purpose, which is basically javascript
                code generated
                dynamically on the server and sent to the client as text. The client
                receives the text string
                and can use with eval(textstring) or a function to interpret the javascript
                code.

                I haven't documented it yet, but here is a wrapper function for
                getURL/XMLHttpRequest
                that allows to either retrieve an XML node or text to be used with eval().

                http://www.carto
                <http://www.carto.net/williams/yosemite/helper_functions.js>
                net/williams/yosemite/helper_functions.js

                have a look at the getData object. Note that his object is slightly
                different from the original
                getXMLData object. It allows for a third parameter that can have the values
                "xml" or "json"

                in http://www.carto <http://www.carto.net/williams/yosemite/search.js>
                net/williams/yosemite/search.js
                have a look at the method "searchObject.prototype.receiveData" which
                receives the json
                text and returns the javascript array through a function.

                You can use the variable myResults as an array to populate the selectionList

                Here is an example server request that returns a json array:

                http://www.carto <http://www.carto.net/williams/yosemite/sendNameData.php?>
                net/williams/yosemite/sendNameData.php?
                searchstring=Half&searchtype=starts
                with&offset=0&limit=10&xmin=244000&ymin=4150000&xmax=308000&ymax=423100
                0&filterByMapExtent=false

                I plan to document these XML/JSON network requests in a tutorial on
                carto.net but am
                currently busy. Will take a bit of time until it is available ...

                Hope this helps a bit,
                Andreas

                --- In svg-developers@ <mailto:svg-developers%40yahoogroups.com>
                yahoogroups.com, "Pascal BENOIST" <pascal.benoist11@...>
                wrote:
                >
                > Hi Andreas,
                >
                >
                >
                > Thanks a lot for your answer,
                >
                > Its ok for the update of the list.
                >
                > My problem in fact is to obtain the node from the url or XMLHttpRequest
                when
                > you say:
                >
                > �you can query a new array from the database on the server using a
                > network request (XMLHttpRequest and getURL).�
                >
                > I would like to use the same fonctions that I use to retrieve geometry (I
                > already use helpers_functions.js for that).
                >
                > I don�t know how to retrieve data that is not <g> or that is not XML
                like an
                > array of elements�
                >
                > Am I obliged to integrate it in a <g> element in my svg before to use it
                > through a js script?
                >
                > Pascal BENOIST
                > Mob: +33 (0)6 12 61 68 02
                > Fixe: +33 (0)4 50 75 17 74
                >
                > _____
                >
                > De : svg-developers@ <mailto:svg-developers%40yahoogroups.com>
                yahoogroups.com [mailto:svg-developers@
                <mailto:svg-developers%40yahoogroups.com> yahoogroups.com]
                > De la part de Andreas Neumann
                > Envoy� : mercredi 2 ao�t 2006 15:53
                > � : svg-developers@ <mailto:svg-developers%40yahoogroups.com>
                yahoogroups.com
                > Objet : [svg-developers] Re: populate a carto.net selectionList
                >
                >
                >
                > HI Pascal,
                >
                > its actually easier than that. You don't need to remove and add
                > individual elements, you can simply replace the property
                > ".elementsArray" of the second selectionList, e.g.
                > -------
                > selectionList2.elementsArray = newArray;
                > selectionList2.selectElementByPosition(0,false);
                > -------
                >
                > note that I propose to also call the method
                > .selectElementByPosition() to make sure that the second
                > selectionlist now displays a valid value of the new array.
                >
                > As an example see http://www.carto
                > <http://www.carto <http://www.carto.net/papers/svg/gui/selectionlist/>
                net/papers/svg/gui/selectionlist/>
                > net/papers/svg/gui/selectionlist/
                > index.svg
                >
                > see the two selectionlists at the upper right.
                >
                > See http://www.carto
                > <http://www.carto
                <http://www.carto.net/papers/svg/gui/selectionlist/init.js>
                net/papers/svg/gui/selectionlist/init.js>
                > net/papers/svg/gui/selectionlist/init.js and the
                > function "updateNumbers2" to see how I set the new values.
                >
                > you can query a new array from the database on the server using a
                > network request (XMLHttpRequest and getURL).
                >
                > The same also works for comboboxes: see http://www.carto
                > <http://www.carto <http://www.carto.net/williams/> net/williams/>
                net/williams/
                > yosemite/, go to the "Search" tab and enter something in the texbox.
                > As you type the values in the combobox are populated with the results
                > of a database query.
                >
                > Hope this helps,
                > Andreas
                >
                > --- In svg-developers@ <mailto:svg-developers%40yahoogroups.com>
                > yahoogroups.com,
                > "pascal.benoist" <pascal.benoist11@> wrote:
                > >
                > > Hello,
                > >
                > > I just developpe a little query builder for my svg application and
                > i
                > > use SelectionLists from carto.net
                > >
                > > I would like to populate automatically a selectionList from the
                > > choice made in a preceding selectionList.
                > > First, I create 2 selectionLists (selectionList1 and
                > selectionList2)
                > > The first one is populated directly at the creation.
                > > The second one is first populated with a empty array.
                > >
                > > I choose a value in SelectionList1
                > > Then , I run a PHP script with this parameter, request my DB (I
                > > request :
                > > DESCRIBE <MyTable> ) with <MyTable> the item selected in
                > > selectionList1 Then, I would like to automatically populate
                > > selectionList2 with the values return from the request (those
                > values
                > > are the Fields of <MyTable>)
                > >
                > > Would you have any tutorial that explain that?
                > >
                > > Secondly, I cannot understand why the above Javascript code does
                > not
                > > work :
                > > function updateSelectionList
                > > selectionListName,selectedIndex,selectedValue)
                > > {
                > > // reinitialisation de selectionListDynLayer
                > > position = 0;
                > > while
                > > (selectionListDynLayer.selectElementByPosition(position,false)) {
                > > MyAlert("deleting element position " + position
                > > + " : " + selectionListDynLayer.getCurrentSelectionElement());
                > >
                > > selectionListDynLayer.deleteElement
                > > (selectionListDynLayer.getCurrentSelectio
                > > nElement());
                > > position++;
                > > }
                > >
                > > MyAlert("selected : " + selectedValue);
                > > selectionListArray = new
                > > Array(getSelectionListArray(selectedValue));
                > >
                > > MyAlert("selectionListArray : " + selectionListArray);
                > > for (i=0;i<selectionListArray.length;i++) {
                > > selectionListDynLayer.addElementAtPosition(selectionListArray
                > > [i],i);
                > > }
                > > }
                > >
                > > function getSelectionListArray(MyTable) {
                > > PHPFileName = "../files/getSelectionListArray.php?MyTable="
                > > + MyTable;
                > > getDataObjSelectionListArray.url=PHPFileName;
                > > getDataObjSelectionListArray.getData();
                > > }
                > >
                > > function callbackSelectionListArray(theNode) {
                > > MyAlert("callback:" + printNode(theNode));
                > > return theNode; // not sure it is a good idea ...
                > > }
                > >
                > > Thanks
                > >
                >
                >
                >
                >
                ----------------------------------------------------------
                > -----------
                > Orange vous informe que cet e-mail a �t� contr�l� par l'anti-virus
                mail.
                > Aucun virus connu � ce jour par nos services n'a �t� d�tect�.
                >
                >
                >
                >
                >
                > [Non-text portions of this message have been removed]
                >



                ----------------------------------------------------------------------------
                -----------
                Orange vous informe que cet e-mail a été contrôlé par l'anti-virus mail.
                Aucun virus connu à ce jour par nos services n'a été détecté.





                [Non-text portions of this message have been removed]
              • Ronan Oger
                Pascal, The great thing about JSON is that the principle is trivial. The concept is to send a text string which is evaluated (usually through an eval
                Message 7 of 8 , Sep 12, 2006
                • 0 Attachment
                  Pascal,

                  The great thing about JSON is that the principle is trivial.

                  The concept is to send a text string which is evaluated (usually through an
                  'eval' statement) in the client side. The string is verbatim the source code
                  that generates the structure on the client side. In other words, it is
                  fundamentally a clientside scripting code injection.

                  Take a look at:

                  [1] the json website
                  http://www.json.org

                  [2] a talk at www2006 by the creator of json
                  http://www2006.org/programme/item.php?id=d8

                  [3] a talk I gave at EU SVG Workshop and at www2006 about an SVG Ajax
                  implementation based on JSON
                  http://www.roitsystems.com/twiki/bin/view/SVGWorkshop/TalkSVGDataWidgets




                  On Tuesday 12 September 2006 12:14, Pascal BENOIST wrote:
                  > Hi Andreas,
                  >
                  >
                  >
                  > In a way to have a better comprehension of JSON principles, could you send
                  > me the php file that write the json code (like sendNameData.php) ?
                  >
                  >
                  >
                  > Pascal BENOIST
                  > pascal.benoist11@...
                  > Mob: +33 (0)6 12 61 68 02
                  > Fixe: +33 (0)4 50 75 17 74
                  >
                  > _____
                  >
                  > De : svg-developers@yahoogroups.com [mailto:svg-developers@yahoogroups.com]
                  > De la part de Andreas Neumann
                  > Envoyé : jeudi 3 août 2006 23:37
                  > À : svg-developers@yahoogroups.com
                  > Objet : [svg-developers] Re: populate a carto.net selectionList
                  >
                  >
                  >
                  > Hi Pascal,
                  >
                  > you can use the json format for that purpose, which is basically javascript
                  > code generated
                  > dynamically on the server and sent to the client as text. The client
                  > receives the text string
                  > and can use with eval(textstring) or a function to interpret the javascript
                  > code.
                  >
                  > I haven't documented it yet, but here is a wrapper function for
                  > getURL/XMLHttpRequest
                  > that allows to either retrieve an XML node or text to be used with eval().
                  >
                  > http://www.carto
                  > <http://www.carto.net/williams/yosemite/helper_functions.js>
                  > net/williams/yosemite/helper_functions.js
                  >
                  > have a look at the getData object. Note that his object is slightly
                  > different from the original
                  > getXMLData object. It allows for a third parameter that can have the values
                  > "xml" or "json"
                  >
                  > in http://www.carto <http://www.carto.net/williams/yosemite/search.js>
                  > net/williams/yosemite/search.js
                  > have a look at the method "searchObject.prototype.receiveData" which
                  > receives the json
                  > text and returns the javascript array through a function.
                  >
                  > You can use the variable myResults as an array to populate the
                  > selectionList
                  >
                  > Here is an example server request that returns a json array:
                  >
                  > http://www.carto
                  > <http://www.carto.net/williams/yosemite/sendNameData.php?>
                  > net/williams/yosemite/sendNameData.php?
                  > searchstring=Half&searchtype=starts
                  > with&offset=0&limit=10&xmin=244000&ymin=4150000&xmax=308000&ymax=423100
                  > 0&filterByMapExtent=false
                  >
                  > I plan to document these XML/JSON network requests in a tutorial on
                  > carto.net but am
                  > currently busy. Will take a bit of time until it is available ...
                  >
                  > Hope this helps a bit,
                  > Andreas
                  >
                  > --- In svg-developers@ <mailto:svg-developers%40yahoogroups.com>
                  > yahoogroups.com, "Pascal BENOIST" <pascal.benoist11@...>
                  >
                  > wrote:
                  > > Hi Andreas,
                  > >
                  > >
                  > >
                  > > Thanks a lot for your answer,
                  > >
                  > > Its ok for the update of the list.
                  > >
                  > > My problem in fact is to obtain the node from the url or XMLHttpRequest
                  >
                  > when
                  >
                  > > you say:
                  > >
                  > > �you can query a new array from the database on the server using a
                  > > network request (XMLHttpRequest and getURL).�
                  > >
                  > > I would like to use the same fonctions that I use to retrieve geometry (I
                  > > already use helpers_functions.js for that).
                  > >
                  > > I don�t know how to retrieve data that is not <g> or that is not XML
                  >
                  > like an
                  >
                  > > array of elements�
                  > >
                  > > Am I obliged to integrate it in a <g> element in my svg before to use it
                  > > through a js script?
                  > >
                  > > Pascal BENOIST
                  > > Mob: +33 (0)6 12 61 68 02
                  > > Fixe: +33 (0)4 50 75 17 74
                  > >
                  > > _____
                  > >
                  > > De : svg-developers@ <mailto:svg-developers%40yahoogroups.com>
                  >
                  > yahoogroups.com [mailto:svg-developers@
                  > <mailto:svg-developers%40yahoogroups.com> yahoogroups.com]
                  >
                  > > De la part de Andreas Neumann
                  > > Envoy� : mercredi 2 ao�t 2006 15:53
                  > > � : svg-developers@ <mailto:svg-developers%40yahoogroups.com>
                  >
                  > yahoogroups.com
                  >
                  > > Objet : [svg-developers] Re: populate a carto.net selectionList
                  > >
                  > >
                  > >
                  > > HI Pascal,
                  > >
                  > > its actually easier than that. You don't need to remove and add
                  > > individual elements, you can simply replace the property
                  > > ".elementsArray" of the second selectionList, e.g.
                  > > -------
                  > > selectionList2.elementsArray = newArray;
                  > > selectionList2.selectElementByPosition(0,false);
                  > > -------
                  > >
                  > > note that I propose to also call the method
                  > > .selectElementByPosition() to make sure that the second
                  > > selectionlist now displays a valid value of the new array.
                  > >
                  > > As an example see http://www.carto
                  > > <http://www.carto <http://www.carto.net/papers/svg/gui/selectionlist/>
                  >
                  > net/papers/svg/gui/selectionlist/>
                  >
                  > > net/papers/svg/gui/selectionlist/
                  > > index.svg
                  > >
                  > > see the two selectionlists at the upper right.
                  > >
                  > > See http://www.carto
                  > > <http://www.carto
                  >
                  > <http://www.carto.net/papers/svg/gui/selectionlist/init.js>
                  > net/papers/svg/gui/selectionlist/init.js>
                  >
                  > > net/papers/svg/gui/selectionlist/init.js and the
                  > > function "updateNumbers2" to see how I set the new values.
                  > >
                  > > you can query a new array from the database on the server using a
                  > > network request (XMLHttpRequest and getURL).
                  > >
                  > > The same also works for comboboxes: see http://www.carto
                  > > <http://www.carto <http://www.carto.net/williams/> net/williams/>
                  >
                  > net/williams/
                  >
                  > > yosemite/, go to the "Search" tab and enter something in the texbox.
                  > > As you type the values in the combobox are populated with the results
                  > > of a database query.
                  > >
                  > > Hope this helps,
                  > > Andreas
                  > >
                  > > --- In svg-developers@ <mailto:svg-developers%40yahoogroups.com>
                  > > yahoogroups.com,
                  > >
                  > > "pascal.benoist" <pascal.benoist11@> wrote:
                  > > > Hello,
                  > > >
                  > > > I just developpe a little query builder for my svg application and
                  > >
                  > > i
                  > >
                  > > > use SelectionLists from carto.net
                  > > >
                  > > > I would like to populate automatically a selectionList from the
                  > > > choice made in a preceding selectionList.
                  > > > First, I create 2 selectionLists (selectionList1 and
                  > >
                  > > selectionList2)
                  > >
                  > > > The first one is populated directly at the creation.
                  > > > The second one is first populated with a empty array.
                  > > >
                  > > > I choose a value in SelectionList1
                  > > > Then , I run a PHP script with this parameter, request my DB (I
                  > > > request :
                  > > > DESCRIBE <MyTable> ) with <MyTable> the item selected in
                  > > > selectionList1 Then, I would like to automatically populate
                  > > > selectionList2 with the values return from the request (those
                  > >
                  > > values
                  > >
                  > > > are the Fields of <MyTable>)
                  > > >
                  > > > Would you have any tutorial that explain that?
                  > > >
                  > > > Secondly, I cannot understand why the above Javascript code does
                  > >
                  > > not
                  > >
                  > > > work :
                  > > > function updateSelectionList
                  > > > selectionListName,selectedIndex,selectedValue)
                  > > > {
                  > > > // reinitialisation de selectionListDynLayer
                  > > > position = 0;
                  > > > while
                  > > > (selectionListDynLayer.selectElementByPosition(position,false)) {
                  > > > MyAlert("deleting element position " + position
                  > > > + " : " + selectionListDynLayer.getCurrentSelectionElement());
                  > > >
                  > > > selectionListDynLayer.deleteElement
                  > > > (selectionListDynLayer.getCurrentSelectio
                  > > > nElement());
                  > > > position++;
                  > > > }
                  > > >
                  > > > MyAlert("selected : " + selectedValue);
                  > > > selectionListArray = new
                  > > > Array(getSelectionListArray(selectedValue));
                  > > >
                  > > > MyAlert("selectionListArray : " + selectionListArray);
                  > > > for (i=0;i<selectionListArray.length;i++) {
                  > > > selectionListDynLayer.addElementAtPosition(selectionListArray
                  > > > [i],i);
                  > > > }
                  > > > }
                  > > >
                  > > > function getSelectionListArray(MyTable) {
                  > > > PHPFileName = "../files/getSelectionListArray.php?MyTable="
                  > > > + MyTable;
                  > > > getDataObjSelectionListArray.url=PHPFileName;
                  > > > getDataObjSelectionListArray.getData();
                  > > > }
                  > > >
                  > > > function callbackSelectionListArray(theNode) {
                  > > > MyAlert("callback:" + printNode(theNode));
                  > > > return theNode; // not sure it is a good idea ...
                  > > > }
                  > > >
                  > > > Thanks
                  >
                  > ----------------------------------------------------------
                  >
                  > > -----------
                  > > Orange vous informe que cet e-mail a �t� contr�l� par
                  > > l'anti-virus
                  >
                  > mail.
                  >
                  > > Aucun virus connu � ce jour par nos services n'a �t� d�tect�.
                  > >
                  > >
                  > >
                  > >
                  > >
                  > > [Non-text portions of this message have been removed]
                  >
                  > ---------------------------------------------------------------------------
                  >- -----------
                  > Orange vous informe que cet e-mail a été contrôlé par l'anti-virus mail.
                  > Aucun virus connu à ce jour par nos services n'a été détecté.
                  >
                  >
                  >
                  >
                  >
                  > [Non-text portions of this message have been removed]
                  >
                  >
                  >
                  > -----
                  > To unsubscribe send a message to:
                  > svg-developers-unsubscribe@yahoogroups.com -or-
                  > visit http://groups.yahoo.com/group/svg-developers and click "edit my
                  > membership" ----
                  > Yahoo! Groups Links
                  >
                  >
                  >
                  >
                  >
                  >

                  --
                  Ronan Oger
                  Director
                  RO IT Systems GmbH
                  ...Building Web2.0 with SVG since 2001

                  http://www.roitsystems.com
                • Pascal BENOIST
                  Hi Andreas, First of all, « Tous mes vœux de bonheur… » Andre M.Winter could answer one of my questions about the php code to write for JSON methode and
                  Message 8 of 8 , Sep 27, 2006
                  • 0 Attachment
                    Hi Andreas,



                    First of all, � Tous mes v�ux de bonheur� �

                    Andre M.Winter could answer one of my questions about the php code to write
                    for JSON methode and now it�s OK.

                    I have a subsidiary question about the function receive data found in the
                    script search.js and helper_functions.js :



                    As I understand, the code is not ok if I want to react differently from 2
                    different getData requests? To be more clear (excuse my poor English), what
                    I would like to do is :



                    To use the �generic� code of helper_functions.js about get and receive
                    functions,

                    In the code of the search.js file, to request 2 different getData and then,
                    to receive 2 different callback : For exemple, I use 2 different
                    SelectionLists and so I would like to have 2 different receive data code
                    BUT, using the only �receive� code written in helper_functions.js :

                    //this is the callback method for the getURL function

                    getData.prototype.operationComplete = function(data) {

                    //check if data has a success property

                    if (data.success) {

                    //parse content of the XML format to the variable "node"

                    if (this.returnFormat == "xml") {

                    var node = parseXML(data.content,document);

                    this.callBackFunction(node.firstChild);

                    }

                    if (this.returnFormat == "json") {

                    if (typeof(this.callBackFunction) == "function") {

                    this.callBackFunction(data.content);

                    }

                    if (typeof(this.callBackFunction) == "object") {

                    this.callBackFunction.receiveData(data.content);

                    }

                    }

                    }

                    else {

                    alert("something went wrong with dynamic loading of geometry!");

                    }

                    }



                    //this method receives data from XMLHttpRequest

                    getData.prototype.handleEvent = function() {

                    if (this.xmlRequest.readyState == 4) {

                    if (this.returnFormat == "xml") {

                    var importedNode =
                    document.importNode(this.xmlRequest.responseXML.documentElement,true);

                    this.callBackFunction(importedNode);

                    }

                    if (this.returnFormat == "json") {

                    if (typeof(this.callBackFunction) == "function") {

                    this.callBackFunction(this.xmlRequest.responseText);

                    }

                    if (typeof(this.callBackFunction) == "object") {


                    this.callBackFunction.receiveData(this.xmlRequest.responseText);

                    }

                    }

                    }

                    }



                    Do you understand my problem?



                    Pascal BENOIST
                    pascal.benoist11@...
                    Mob: +33 (0)6 12 61 68 02
                    Fixe: +33 (0)4 50 75 17 74

                    _____

                    De : svg-developers@yahoogroups.com [mailto:svg-developers@yahoogroups.com]
                    De la part de Andreas Neumann
                    Envoy� : jeudi 3 ao�t 2006 23:37
                    � : svg-developers@yahoogroups.com
                    Objet : [svg-developers] Re: populate a carto.net selectionList



                    Hi Pascal,

                    you can use the json format for that purpose, which is basically javascript
                    code generated
                    dynamically on the server and sent to the client as text. The client
                    receives the text string
                    and can use with eval(textstring) or a function to interpret the javascript
                    code.

                    I haven't documented it yet, but here is a wrapper function for
                    getURL/XMLHttpRequest
                    that allows to either retrieve an XML node or text to be used with eval().

                    http://www.carto
                    <http://www.carto.net/williams/yosemite/helper_functions.js>
                    net/williams/yosemite/helper_functions.js

                    have a look at the getData object. Note that his object is slightly
                    different from the original
                    getXMLData object. It allows for a third parameter that can have the values
                    "xml" or "json"

                    in http://www.carto <http://www.carto.net/williams/yosemite/search.js>
                    net/williams/yosemite/search.js
                    have a look at the method "searchObject.prototype.receiveData" which
                    receives the json
                    text and returns the javascript array through a function.

                    You can use the variable myResults as an array to populate the selectionList

                    Here is an example server request that returns a json array:

                    http://www.carto <http://www.carto.net/williams/yosemite/sendNameData.php?>
                    net/williams/yosemite/sendNameData.php?
                    searchstring=Half&searchtype=starts
                    with&offset=0&limit=10&xmin=244000&ymin=4150000&xmax=308000&ymax=423100
                    0&filterByMapExtent=false

                    I plan to document these XML/JSON network requests in a tutorial on
                    carto.net but am
                    currently busy. Will take a bit of time until it is available ...

                    Hope this helps a bit,
                    Andreas

                    --- In svg-developers@ <mailto:svg-developers%40yahoogroups.com>
                    yahoogroups.com, "Pascal BENOIST" <pascal.benoist11@...>
                    wrote:
                    >
                    > Hi Andreas,
                    >
                    >
                    >
                    > Thanks a lot for your answer,
                    >
                    > Its ok for the update of the list.
                    >
                    > My problem in fact is to obtain the node from the url or XMLHttpRequest
                    when
                    > you say:
                    >
                    > ���you can query a new array from the database on the server using a
                    > network request (XMLHttpRequest and getURL).���
                    >
                    > I would like to use the same fonctions that I use to retrieve geometry (I
                    > already use helpers_functions.js for that).
                    >
                    > I don���t know how to retrieve data that is not <g> or that is not XML
                    like an
                    > array of elements���
                    >
                    > Am I obliged to integrate it in a <g> element in my svg before to use it
                    > through a js script?
                    >
                    > Pascal BENOIST
                    > Mob: +33 (0)6 12 61 68 02
                    > Fixe: +33 (0)4 50 75 17 74
                    >
                    > _____
                    >
                    > De : svg-developers@ <mailto:svg-developers%40yahoogroups.com>
                    yahoogroups.com [mailto:svg-developers@
                    <mailto:svg-developers%40yahoogroups.com> yahoogroups.com]
                    > De la part de Andreas Neumann
                    > Envoy��� : mercredi 2 ao���t 2006 15:53
                    > ��� : svg-developers@ <mailto:svg-developers%40yahoogroups.com>
                    yahoogroups.com
                    > Objet : [svg-developers] Re: populate a carto.net selectionList
                    >
                    >
                    >
                    > HI Pascal,
                    >
                    > its actually easier than that. You don't need to remove and add
                    > individual elements, you can simply replace the property
                    > ".elementsArray" of the second selectionList, e.g.
                    > -------
                    > selectionList2.elementsArray = newArray;
                    > selectionList2.selectElementByPosition(0,false);
                    > -------
                    >
                    > note that I propose to also call the method
                    > .selectElementByPosition() to make sure that the second
                    > selectionlist now displays a valid value of the new array.
                    >
                    > As an example see http://www.carto
                    > <http://www.carto <http://www.carto.net/papers/svg/gui/selectionlist/>
                    net/papers/svg/gui/selectionlist/>
                    > net/papers/svg/gui/selectionlist/
                    > index.svg
                    >
                    > see the two selectionlists at the upper right.
                    >
                    > See http://www.carto
                    > <http://www.carto
                    <http://www.carto.net/papers/svg/gui/selectionlist/init.js>
                    net/papers/svg/gui/selectionlist/init.js>
                    > net/papers/svg/gui/selectionlist/init.js and the
                    > function "updateNumbers2" to see how I set the new values.
                    >
                    > you can query a new array from the database on the server using a
                    > network request (XMLHttpRequest and getURL).
                    >
                    > The same also works for comboboxes: see http://www.carto
                    > <http://www.carto <http://www.carto.net/williams/> net/williams/>
                    net/williams/
                    > yosemite/, go to the "Search" tab and enter something in the texbox.
                    > As you type the values in the combobox are populated with the results
                    > of a database query.
                    >
                    > Hope this helps,
                    > Andreas
                    >
                    > --- In svg-developers@ <mailto:svg-developers%40yahoogroups.com>
                    > yahoogroups.com,
                    > "pascal.benoist" <pascal.benoist11@> wrote:
                    > >
                    > > Hello,
                    > >
                    > > I just developpe a little query builder for my svg application and
                    > i
                    > > use SelectionLists from carto.net
                    > >
                    > > I would like to populate automatically a selectionList from the
                    > > choice made in a preceding selectionList.
                    > > First, I create 2 selectionLists (selectionList1 and
                    > selectionList2)
                    > > The first one is populated directly at the creation.
                    > > The second one is first populated with a empty array.
                    > >
                    > > I choose a value in SelectionList1
                    > > Then , I run a PHP script with this parameter, request my DB (I
                    > > request :
                    > > DESCRIBE <MyTable> ) with <MyTable> the item selected in
                    > > selectionList1 Then, I would like to automatically populate
                    > > selectionList2 with the values return from the request (those
                    > values
                    > > are the Fields of <MyTable>)
                    > >
                    > > Would you have any tutorial that explain that?
                    > >
                    > > Secondly, I cannot understand why the above Javascript code does
                    > not
                    > > work :
                    > > function updateSelectionList
                    > > selectionListName,selectedIndex,selectedValue)
                    > > {
                    > > // reinitialisation de selectionListDynLayer
                    > > position = 0;
                    > > while
                    > > (selectionListDynLayer.selectElementByPosition(position,false)) {
                    > > MyAlert("deleting element position " + position
                    > > + " : " + selectionListDynLayer.getCurrentSelectionElement());
                    > >
                    > > selectionListDynLayer.deleteElement
                    > > (selectionListDynLayer.getCurrentSelectio
                    > > nElement());
                    > > position++;
                    > > }
                    > >
                    > > MyAlert("selected : " + selectedValue);
                    > > selectionListArray = new
                    > > Array(getSelectionListArray(selectedValue));
                    > >
                    > > MyAlert("selectionListArray : " + selectionListArray);
                    > > for (i=0;i<selectionListArray.length;i++) {
                    > > selectionListDynLayer.addElementAtPosition(selectionListArray
                    > > [i],i);
                    > > }
                    > > }
                    > >
                    > > function getSelectionListArray(MyTable) {
                    > > PHPFileName = "../files/getSelectionListArray.php?MyTable="
                    > > + MyTable;
                    > > getDataObjSelectionListArray.url=PHPFileName;
                    > > getDataObjSelectionListArray.getData();
                    > > }
                    > >
                    > > function callbackSelectionListArray(theNode) {
                    > > MyAlert("callback:" + printNode(theNode));
                    > > return theNode; // not sure it is a good idea ...
                    > > }
                    > >
                    > > Thanks
                    > >
                    >
                    >
                    >
                    >
                    ----------------------------------------------------------
                    > -----------
                    > Orange vous informe que cet e-mail a ���t��� contr���l��� par l'anti-virus
                    mail.
                    > Aucun virus connu ��� ce jour par nos services n'a ���t��� d���tect���.
                    >
                    >
                    >
                    >
                    >
                    > [Non-text portions of this message have been removed]
                    >



                    ----------------------------------------------------------------------------
                    -----------
                    Orange vous informe que cet e-mail a �t� contr�l� par l'anti-virus mail.
                    Aucun virus connu � ce jour par nos services n'a �t� d�tect�.





                    [Non-text portions of this message have been removed]
                  Your message has been successfully submitted and would be delivered to recipients shortly.