Show/hide and update combo box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • truptivk
    New Member
    • Sep 2009
    • 14

    Show/hide and update combo box

    Hello all,

    I have a situation and I'd appreciate it if any of you could help me. I am not sure if this is js or html but here goes. I have a main combo box (mcb) which I'm displaying some values.

    Based on what the user chooses, 2 combo boxes should be displayed on same page. The first combo box (CB1), should be filled with some values. The second, (CB2) however, should get loaded on basis of what is chosen in CB1. UNtil then, CB2 should be empty (but visible). When user chooses a value in CB1, and then CB2, a 3rd combo box, CB3 should be displayed. CB3 will have values already, based on what is chosen in CB2. If use decides not to select any value from CB2, CB3 is not displayed at all.

    Until now, this is what I have done.

    1. I have the main combo box (mcb).
    2. In Onchange event of mcb, CB1 and CB2 get displayed. CB1 has values, CB2 does not.
    3. In OnChange of CB1, CB2 gets populated.

    Thats all. Now I want a CB3 to be displayed with values in it, depending on if and what the user chooses in CB2.

    Can anyone help? :)

    Thanks!
    Trupti
  • ssnaik84
    New Member
    • Aug 2009
    • 149

    #2
    are you using AJAX or normal ASP.NET stuff?

    Comment

    • truptivk
      New Member
      • Sep 2009
      • 14

      #3
      Neither. Just js, html and php.

      Comment

      • ssnaik84
        New Member
        • Aug 2009
        • 149

        #4
        bind dataview to your CB3..
        use DataView.RowFil ter to filter it each time, when user change value of CB2..
        and bind it to CB3 again..

        Comment

        • ssnaik84
          New Member
          • Aug 2009
          • 149

          #5
          ohh.. sorry... i thought you are a .NET developer..

          Comment

          • ssnaik84
            New Member
            • Aug 2009
            • 149

            #6
            use AJAX in such cases.. it will make your life simple.. :)
            there are several good articles here like this

            Comment

            • truptivk
              New Member
              • Sep 2009
              • 14

              #7
              I see... is there anyway to do it with js and html? I don't know Ajax and I'm guessing it'll take me time to understand it and write code for my scenario.

              Comment

              • Dormilich
                Recognized Expert Expert
                • Aug 2008
                • 8694

                #8
                Originally posted by truptivk
                I see... is there anyway to do it with js and html?
                it would only be sensible, if the total content is not too much (because you have to supply all the data for the combo boxes along with the page load).

                Comment

                • truptivk
                  New Member
                  • Sep 2009
                  • 14

                  #9
                  <Dormilich>
                  it would only be sensible, if the total content is not too much (because you have to supply all the data for the combo boxes along with the page load).
                  </Dormilich>

                  Thank you. That is what I was thinking too, if I'm only going to use js and html AND want to be on same page.

                  In which case, it is about 4200 records. (Is that a lot?) If yes, then is Ajax my only hope? :(

                  Comment

                  • Dormilich
                    Recognized Expert Expert
                    • Aug 2008
                    • 8694

                    #10
                    Originally posted by truptivk
                    In which case, it is about 4200 records. (Is that a lot?)
                    I would say so, you’d better use AJAX in this case.

                    Comment

                    • truptivk
                      New Member
                      • Sep 2009
                      • 14

                      #11
                      Thank you, I will do that :) Thank you all for taking time out to respond to my query.

                      Comment

                      Working...