By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,628 Members | 1,880 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,628 IT Pros & Developers. It's quick & easy.

How to programmatically update a menu following changes to another menu

P: 87
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
Apr 18 '08 #1
Share this Question
Share on Google+
8 Replies


jhardman
Expert 2.5K+
P: 3,405
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
Apr 21 '08 #2

jeffstl
Expert 100+
P: 432
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
Apr 21 '08 #3

P: 87
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.

Expand|Select|Wrap|Line Numbers
  1. <SCRIPT language=JavaScript>
  2. function datechange()
  3. {
  4. (document.form1.Status.options[document.form1.Status.selectedIndex].text == "YELLOW");
  5. alert('ALERT: Any change to the Projected Launch Date will result in the TEMPORARY changing of your Status Flag to YELLOW.')
  6. }
  7. </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
Sep 23 '08 #4

jhardman
Expert 2.5K+
P: 3,405
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
Sep 24 '08 #5

P: 87
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.
Sep 24 '08 #6

acoder
Expert Mod 15k+
P: 16,027
Is the drop down element that needs to be changed named "Status"? If so, it's simply:
Expand|Select|Wrap|Line Numbers
  1. document.form1.Status.value = "YELLOW";
providing you've set the option values.
Sep 24 '08 #7

P: 87
That works. Thanks!

JM
Sep 24 '08 #8

acoder
Expert Mod 15k+
P: 16,027
Glad it does and you're welcome.
Sep 24 '08 #9

Post your reply

Sign in to post your reply or Sign up for a free account.