How to programmatically update a menu following changes to another menu

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmartmem
    New Member
    • Feb 2008
    • 87

    How to programmatically update a menu following changes to another menu

    Greetings,

    I have an Dreamweaver CS3 ASP page (profile.asp) in which project management users can update project information presented in a Record Update Form. I have three menu form fields ("FY", "Qtr" and "Mth") included in a fieldset form element that contain the values for a project's deadline: fiscal year, quarter and month, respectively.

    My goal is to build functionality into the page such that when a user changes a value for any of the three aforementioned date menu fields, an automatic change will occur to the value of a fourth menu field in the fieldset (named "Status"), changing its value to a pre-determined setting (in this case, the word "Yellow"). I would also like to then lock the "Status" menu field so that a user can't return the field value to its original setting.

    I know how to code this in VisualBasic for a MS Access form, but am not sure how to accomplish the same in ASP.

    I can provide detailed code for anyone who needs it. Whatever help anybody can offer would be most appreciated.

    Regards,

    - JM
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Go ahead and post your code, that might help. I think the issue, though, is that you need client-side coding to get this to work, and ASP is strictly server-side (it only runs while the page is loading, after that ASP code is dead). So a better question would be to ask "how do I do this with javascript". Let me know if this helps.

    Jared

    Comment

    • jeffstl
      Recognized Expert Contributor
      • Feb 2008
      • 432

      #3
      Originally posted by jmartmem
      Greetings,

      I have an Dreamweaver CS3 ASP page (profile.asp) in which project management users can update project information presented in a Record Update Form. I have three menu form fields ("FY", "Qtr" and "Mth") included in a fieldset form element that contain the values for a project's deadline: fiscal year, quarter and month, respectively.

      My goal is to build functionality into the page such that when a user changes a value for any of the three aforementioned date menu fields, an automatic change will occur to the value of a fourth menu field in the fieldset (named "Status"), changing its value to a pre-determined setting (in this case, the word "Yellow"). I would also like to then lock the "Status" menu field so that a user can't return the field value to its original setting.

      I know how to code this in VisualBasic for a MS Access form, but am not sure how to accomplish the same in ASP.

      I can provide detailed code for anyone who needs it. Whatever help anybody can offer would be most appreciated.

      Regards,

      - JM
      Again same question, is this asp.net or classic asp?

      if it is asp.net then you can use the onChange event of the controls you refer to, that will trigger your code to populate your second control.

      If classic asp then you will need to either refresh your page each time and send the parameters through a querystring, or you will have to use client side scripting such as javascript

      Comment

      • jmartmem
        New Member
        • Feb 2008
        • 87

        #4
        Greetings,

        I started this post several months ago and want to revisit it now as I'm ready to troubleshoot this issue.

        I want to use Javascript to make this work. While I'm far from a Javascript expert, I took a stab at writing the code, which I've posted below.

        Code:
        <SCRIPT language=JavaScript>
        function datechange()
        {
        (document.form1.Status.options[document.form1.Status.selectedIndex].text == "YELLOW");
        alert('ALERT: Any change to the Projected Launch Date will result in the TEMPORARY changing of your Status Flag to YELLOW.')
        }
        </script>
        To summarize what's supposed to happen, this function is called in an onchange event to any of three different list/menus in the form. When the user changes the value in these list/menus (not shown above), I want two things to happen:

        (1) A pop-up alert is activated.
        (2) An automatic change is made to another list/menu in the form (Status) in which the value of this list/menu changes to the word "YELLOW", which is one of three standard values in the list (GREEN, YELLOW, RED).

        As it stands now, I can get (1) to work but not (2). Any help that can be offered would be greatly appreciated.

        Regards,

        JM

        Comment

        • jhardman
          Recognized Expert Specialist
          • Jan 2007
          • 3405

          #5
          so (to confirm) all you want to do is change which option is selected in the second drop-down? I'm not a javascript expert either, I would have to think about it in detail in order to make it work, but if you answer this question I will attempt it.

          (BTW, I moved the thread to the javascript forum so hopefully some javascript experts can weigh in)

          Jared

          Comment

          • jmartmem
            New Member
            • Feb 2008
            • 87

            #6
            That's correct. All I want the function to do is change which option is selected in the second list/menu.

            JM

            P.S. Thanks for moving the thread. I didn't realize it wasn't in the Javascript forum.

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              Is the drop down element that needs to be changed named "Status"? If so, it's simply:
              Code:
              document.form1.Status.value = "YELLOW";
              providing you've set the option values.

              Comment

              • jmartmem
                New Member
                • Feb 2008
                • 87

                #8
                That works. Thanks!

                JM

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #9
                  Glad it does and you're welcome.

                  Comment

                  Working...