Solved

Calculate text fields based on listbox choice

Posted on 2004-04-22
6
437 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

821 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