Solved

Calculate text fields based on listbox choice

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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…

863 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now