Dynamic Values for DropDowns

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ynaveen9
    New Member
    • Sep 2012
    • 4

    Dynamic Values for DropDowns

    I have a page with all form field to take input from user.
    ex : when user selects a Country automatically all the states within that country should be populated in second list box with values(states) fetched from database.
    and if I select state again all the cities under this state would appear in 3rd drop down.. like that...

    I know Ajax will do this thing.. But can anyone point me to the sample code..
  • DroidSlave300
    New Member
    • Sep 2012
    • 3

    #2
    What platform are you working with? .NET, PHP, Other?

    Comment

    • ynaveen9
      New Member
      • Sep 2012
      • 4

      #3
      am using Perl/CGI. Can you point to me some sample code for this purpose?

      Thanks a bunch!

      Comment

      • Fary4u
        Contributor
        • Jul 2007
        • 273

        #4
        i think best to use ajax or java script as passing values to perl or cgi.

        Comment

        • ynaveen9
          New Member
          • Sep 2012
          • 4

          #5
          Thanks Fary4u for ur reply. Do you have some simple/sample code to show in for the same? I searched in web but all are confusing for a beginner like me.

          Comment

          • Fary4u
            Contributor
            • Jul 2007
            • 273

            #6
            give you idea to start with is.
            Code:
            <SCRIPT>
            function checkLink(s) {
            var val = escape(s)
            var val = form1.dropdown.options[form1.dropdown.options.selectedIndex].value;
            </script>
            you can write like this.
            Code:
            document.getElementById("result").innerHTML = val;

            Comment

            Working...