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

Dynamic linked select inputs retrieving options remotely using AJAX

Expand Messages
  • Manuel Lemos
    Hello, I have just finished implementing several enhancements that make possible to use the linked select inputs in a way that they retrieved the new set of
    Message 1 of 4 , Dec 30, 2005
    • 0 Attachment
      Hello,

      I have just finished implementing several enhancements that make
      possible to use the linked select inputs in a way that they retrieved
      the new set of options from the server using AJAX.

      Now there is a parameter named Dynamic that makes the input retrieve the
      options from the server dynamically, rather than loading all at once the
      options groups in the forms Javascript.

      This enhancement opened the possibility to take the groups of options
      from other sources besides static arrays.

      To demonstrate this possibility I also created a new plug-in class that
      extends the linked select input to retrieve the options from a database
      rather the static groups arrays.

      This new plug-in class uses the Metabase API to access the database. So,
      it can work with many databases. I am also providing a database schema
      definition in the Metabase schema format and an installation script so
      you can easily setup the database to run the example script.

      I am also going to provide another plug-in class that uses the MySQL API
      directly. I will upload MySQL linked select plug-in later today. Other
      APIs maybe supported by other developers that use them. It is easy to
      adapt the custom plug-in examples.

      Please test this now and let me know of any problems that you may find.
      I will publish this new version next week. Meanwhile you may find this
      beta version files here:

      http://groups.yahoo.com/group/forms-dev/files/beta/

      --

      Regards,
      Manuel Lemos

      Metastorage - Data object relational mapping layer generator
      http://www.metastorage.net/

      PHP Classes - Free ready to use OOP components written in PHP
      http://www.phpclasses.org/
    • operationsengineer1@yahoo.com
      ... hi Manuel. thanks for the updates to the forms class. i m trying to learn how you implement ajax. is it possible to have an adodb plugin? it is pretty
      Message 2 of 4 , Jan 11, 2006
      • 0 Attachment
        > Hello,
        >
        > I have just finished implementing several
        > enhancements that make
        > possible to use the linked select inputs in a way
        > that they retrieved
        > the new set of options from the server using AJAX.
        >
        > Now there is a parameter named Dynamic that makes
        > the input retrieve the
        > options from the server dynamically, rather than
        > loading all at once the
        > options groups in the forms Javascript.
        >
        > This enhancement opened the possibility to take the
        > groups of options
        > from other sources besides static arrays.
        >
        > To demonstrate this possibility I also created a new
        > plug-in class that
        > extends the linked select input to retrieve the
        > options from a database
        > rather the static groups arrays.
        >
        > This new plug-in class uses the Metabase API to
        > access the database. So,
        > it can work with many databases. I am also providing
        > a database schema
        > definition in the Metabase schema format and an
        > installation script so
        > you can easily setup the database to run the example
        > script.
        >
        > I am also going to provide another plug-in class
        > that uses the MySQL API
        > directly. I will upload MySQL linked select plug-in
        > later today. Other
        > APIs maybe supported by other developers that use
        > them. It is easy to
        > adapt the custom plug-in examples.
        >
        > Please test this now and let me know of any problems
        > that you may find.
        > I will publish this new version next week. Meanwhile
        > you may find this
        > beta version files here:
        >
        > http://groups.yahoo.com/group/forms-dev/files/beta/
        >
        > --
        >
        > Regards,
        > Manuel Lemos

        hi Manuel. thanks for the updates to the forms class.
        i'm trying to learn how you implement ajax. is it
        possible to have an adodb plugin? it is pretty
        popular, after all.

        i'll study your implementation, but i want to ask
        anyway. is it possible to send a query to the db
        based on variables already set in two prior select
        boxes? i'll dig in and see if i can figure it out on
        my own.

        thanks again.

        __________________________________________________
        Do You Yahoo!?
        Tired of spam? Yahoo! Mail has the best spam protection around
        http://mail.yahoo.com
      • operationsengineer1@yahoo.com
        ... reviewing GroupsQuery = SELECT code FROM countries , OptionsQuery = SELECT code, name FROM locations WHERE country=? , it looks like it isn t possible
        Message 3 of 4 , Jan 11, 2006
        • 0 Attachment
          > hi Manuel. thanks for the updates to the forms
          > class.
          > i'm trying to learn how you implement ajax. is it
          > possible to have an adodb plugin? it is pretty
          > popular, after all.
          >
          > i'll study your implementation, but i want to ask
          > anyway. is it possible to send a query to the db
          > based on variables already set in two prior select
          > boxes? i'll dig in and see if i can figure it out
          > on
          > my own.
          >
          > thanks again.
          >

          reviewing

          "GroupsQuery"=>"SELECT code FROM countries",
          "OptionsQuery"=>"SELECT code, name FROM locations
          WHERE country=?",

          it looks like it isn't possible to take the input of
          two different select boxes in its current state.

          i envision something like:

          "Groups1Query"=>"SELECT code FROM continents",
          "Groups2Query"=>"SELECT code FROM countries",
          "OptionsQuery"=>"SELECT code, name FROM locations
          WHERE continent=? and country=?",

          of course, this approach doesn't make much sense in
          this case. however, it does make sense when the 2nd
          select is static.

          eg, each serial number has 6 tests and you need to
          check for the pass / fail state of each of the 6
          tests.

          it doesn't make much sense to link the 6 tests to each
          serial number because they aren't variable - they are
          always the same.

          i think i have to break this part of my code into two
          pages and pass the test area variable to the second
          page - then i only have to link two selects.

          again, thanks for the nice forms class. i recommended
          it, over on the php-pgsql mailing list, to some
          php/pgsql newbies trying to set up php and pgsql.

          __________________________________________________
          Do You Yahoo!?
          Tired of spam? Yahoo! Mail has the best spam protection around
          http://mail.yahoo.com
        • Manuel Lemos
          Hello, ... Sure, I do not have an interest on it because I do not use it, but you are welcome to write it. Just pick the existing plug-in sub-classes and adapt
          Message 4 of 4 , Jan 14, 2006
          • 0 Attachment
            Hello,

            on 01/11/2006 08:36 PM operationsengineer1@... said the following:
            > hi Manuel. thanks for the updates to the forms class.
            > i'm trying to learn how you implement ajax. is it
            > possible to have an adodb plugin? it is pretty
            > popular, after all.

            Sure, I do not have an interest on it because I do not use it, but you
            are welcome to write it. Just pick the existing plug-in sub-classes and
            adapt to use that or other database API. Than you can publish it in the
            PHP Classes site as separate dependent class.


            > i'll study your implementation, but i want to ask
            > anyway. is it possible to send a query to the db
            > based on variables already set in two prior select
            > boxes? i'll dig in and see if i can figure it out on
            > my own.

            The class would need to be adapted to work with more than one linked
            input. I do not have time right now, but I may work on that later.

            --

            Regards,
            Manuel Lemos

            Metastorage - Data object relational mapping layer generator
            http://www.metastorage.net/

            PHP Classes - Free ready to use OOP components written in PHP
            http://www.phpclasses.org/
          Your message has been successfully submitted and would be delivered to recipients shortly.