Solved

Calculate text fields based on listbox choice

Posted on 2004-04-22
6
432 Views
Last Modified: 2012-05-04
The project is my first attempt at Java.

I have a PDF form with a (single select) listbox named "Type" the three options are "View," "Folder" or "Action." Based on the users choice in this list box I would like to change the contents of all three (risk) text fields "High," "Medium" and "Low." For example:

If the "Type" field ="View"
Then the: "High" field = "Outside of scope, change denied"
and "Medium" Field = "Complete remedial action and proceed with change"
and "Low" Field = "Proceed with change."

Else if "Type" field = "Folder"
then . . . text for three risk fields

Else if "Type" field = "Action"
then . . . text for three risk fields

Thanks in advance for all assistance.
0
Comment
Question by:mcjann
6 Comments
 
LVL 3

Expert Comment

by:fave_17
ID: 10896230
PDF form?

btw, java is different from javascript
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 10897459
I understand the question like this:

<html>
<head>
<script>
var optVal = new Array();
optVal["View"] = [
"Outside of scope, change denied",
"Complete remedial action and proceed with change",
"Proceed with change."];
optVal["Folder"] = [
"High Folder Risk",
"Medium Folder Risk",
"Low Folder Risk"];
optVal["Action"] = [
"High Action Risk",
"Medium Action Risk",
"Low Action Risk"];


function setChoice(theSel){
  selVal = theSel.value;
  theForm = theSel.form;
  theForm.High.value = optVal[selVal][0];
  theForm.Medium.value = optVal[selVal][1];
  theForm.Low.value = optVal[selVal][2];
}
</script>
</head>
<body onLoad="setChoice(document.forms[0].Type)">
<form>
<select name="Type" onChange="setChoice(this)">
<option value="View" SELECTED>View
<option value="Folder">Folder
<option value="Action">Action
</select><br>
High:
<input type=text name="High"><br>
Medium:
<input type=text name="Medium"><br>
Low:
<input type=text name="Low">
</form>
</body>
</html>


0
 
LVL 1

Author Comment

by:mcjann
ID: 10902383
This is a PDF form with text fields that I would like to calculate using a javascript.

Zvonko, does my untrained eye see html tags in your script?

I am looking for a custom validation script to place in the javascript editor for the "Medium" text field. The result of the script is to display three different text strings based on the choice in the "Type" listbox. A user dialog or prompt is not necessary. The form has multiple fields that the user will complete, one of them is "Type."

If "Type" = "View" then "Medium"= "Look-ups exist and have been indentified."

If "Type" =  "Action" then "Medium" = "Not applicable for actions."

If "Type" =  "Form" then "Medium" = "Moving fields, changing fields names or changing data types."

I will attempt to modify a working script for placement in the Low and High fields.

Thanks for any assistance,
mcjann
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 10922355
no objections.

Zvonko
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10962166
Closed, 300 points refunded.
modulo
Community Support Moderator
Experts Exchange
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Converting dates in JavaScript 2 35
how can i make the array into an object? 4 32
Need Help adding an array and loop to a React file 7 28
How to show span when clicked on? 10 22
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question