Displaying value selected in Drop-down control throu CGI

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tsunet
    New Member
    • May 2007
    • 1

    Displaying value selected in Drop-down control throu CGI

    HI..

    I wana display that, initially in a one drop down control there will be some values.
    Initially, 2nd drop down control will be disabled. if user selects 1st drop down then and then only value which user has selected in 1st drop down control will be displayed in 2nd drop down control. The values can be selected randomly.

    Plz tell me.
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    Are you wanting to do this in the browser? Then use javascript. If you want to do it server side with perl, use the CGI module to get the form data to display whatever it is you need to display.

    Comment

    • tsunethere
      New Member
      • May 2007
      • 6

      #3
      hi .. thanks for reply

      I want to do it server side with perl only. I have 2 drop-down boxes. at first when web page will get load value this drop-down value will be"---" in this fashion. and 2nd drop-down will be disabled. unless and until user selects item from 1st drop-down 2nd will be disabled. As soon as user enter value in 1st drop-down, 2nd will get enabled and user can select value in 2nd drop-down!

      I want to do like this :
      if (value in drop-down1 is changed)
      {
      if(item value="--")
      {
      drop-down2.disabled= "true";
      }
      get value from database;
      }

      how can I code above logic in CGI?
      how can I call this code on drop-down1`s onchange() ?

      Also can u plz briefly explain on CGI module to get the form data to display?


      Thank you.

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        You probably want to use AJAX so ask in the AJAX forum.

        Comment

        • tsunethere
          New Member
          • May 2007
          • 6

          #5
          thanks alot..

          like in .NET we hv runat="server"
          do you know how to handle server side events for Perl?
          is there any other solution for this in Perl?


          thanks
          i m badly in need of it..

          Comment

          • KevinADC
            Recognized Expert Specialist
            • Jan 2007
            • 4092

            #6
            Perl has no concept of "events" that I am aware of. There are some perl modules that create ajax code, but of course that is a combination of javascript and perl code. The javascript works in the browser to dynamically update parts of a webpage using perl on the server. I am sure it could be used to do what you want, but I don't know how to do it myslef. Or you could go with a pure perl solution but that would not include "disabling" a drop down menu as perl has no concept of what happens in the browser window. You could print a form with a drop down menu, and send the form data to a perl script. The perl script will evaluate the values of the form fields and can dynamically generate another form depending on the values from the first form. You would use conditional statements for that.

            Comment

            Working...