473,566 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change value of one variable based on user input of another value

I am trying to use an if then in javascript to change one value based
on what a user inputs for another value. It is not working correctly.
Here is the relevant code:
---------------------------
<script language="javas cript" >

function decideWhoToMail To(dform) {
if (document.dform .ru.value == "122") {
document.dform. param_pie = "me@mycompany.o rg";
} else if (document.dform .ru.value == "144") {
document.dform. param_pie = "yo*@mycompany. org";
}

}

</script>
-----------------------------
<FORM name="dform"
ACTION="http://intranet.mycomp any.org/cgi-bin/purchase2.pl" METHOD=POST

onsubmit="decid eWhoToMailTo(th is);" >

<INPUT TYPE="hidden" name="param_pie ">
RU: <input type="text" name="ru" value="122" tabindex="2">
----------------------------
I then passed the param_pie to the cgi script just to see what it is
being set to. It is being set to blank.

Can you see where I went wrong? I am leaving the ru set to the default

value of 122, so I would expect param_pie to be set to me@mycompany.or g.

Dec 1 '06 #1
1 1484
VK
<script language="javas cript" >
>
function decideWhoToMail To(dform) {
if (document.dform .ru.value == "122") {
document.dform. param_pie = "me@mycompany.o rg";
} else if (document.dform .ru.value == "144") {
document.dform. param_pie = "yo*@mycompany. org";
}

}

</script>
-----------------------------
<FORM name="dform"
ACTION="http://intranet.mycomp any.org/cgi-bin/purchase2.pl" METHOD=POST

onsubmit="decid eWhoToMailTo(th is);" >

<INPUT TYPE="hidden" name="param_pie ">
RU: <input type="text" name="ru" value="122" tabindex="2">

1) dform is a direct reference to your form, no document reference is
needed.

2) form control value is changed over it .value property
<script type="text/javascript" >

function decideWhoToMail To(dform) {
if (dform.ru.value == "122") {
dform.param_pie .value = "m...@mycompany .org";
} else if (dform.ru.value == "144") {
dform.param_pie .value = "y...@mycompany .org";
}
}

</script>

Dec 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
11429
by: Sylvie Stone | last post by:
Hi group - I have an html form for that uses username and password to login to a specific area of the website. The "area" the user wants to go to is based on a pull down menu. Becasue the user/password info is in differnet databases, how can I call different validation scripts based on this input ? THANK YOU! See below please....
2
3065
by: reneeccwest | last post by:
Different user input boxes are automatically populated based on a value of the dropdown box. Can anyone help me on that?
2
9310
by: Irvin Amoraal | last post by:
I am new to javascript coding. I am using some javascript code to change an image on an html page. I would like the user to click on the image to bring them to another page. I need to change an href to include an id value based on the image. Here's the process: 1. select an image from a drop down list. 2. view the image on the same...
4
2599
by: Richard Cornford | last post by:
For the last couple of months I have been trying to get the next round of updates to the FAQ underway and been being thwarted by a heavy workload (the project I am working on has to be finished an QA tested for a new year release. I don't think that going to prove practical, but there is no harm in trying :) and some serious family...
1
1338
by: SK | last post by:
Hi I am trying a simpler version of a program I was trying to write. The idea is to have someone enter the information and then at the end of the program display all of the info. in a table. I have a feeling the errors I am making are probably stupid but I would appreciate any imput. //Specs to be added later //C Libraries
7
2133
by: dotnetnoob | last post by:
i keep getting Object references not set to an instance of an object from this code: Private Sub EqBinding() Dim x As Integer x = 0 Do If CStr(arlsType.Item(x)) = "Bacnet Point" Then Dim str1, str2 As String str1 = CStr(arlsFilePath.Item(x))
2
3396
by: Mirovk | last post by:
Hi, I have a session variable wich value arrives from a previous .asp but in my actual page I need to modify it based upon a selected value from a radio button. I will try to figure out for better understanding: page1.asp ---session("PaymentMethod") page2.asp ---Depending on the radio button selected the payment
10
6061
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio button with this link of code: echo 'SCRIPT language=JavaScript setCheckedValue("'.$_SESSION.'");</SCRIPT>'; //? <snip of code>
11
26545
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package and PEAR is in c:\wamp\php\pear I modified php.ini in the c:\wamp\php directory to reflect the actual path, but even stopping and restarting my...
0
7666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7644
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.