Solved

Calculate text fields based on listbox choice

Posted on 2004-04-22
6
422 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
Comment Utility
PDF form?

btw, java is different from javascript
0
 
LVL 63

Expert Comment

by:Zvonko
Comment Utility
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
Comment Utility
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
Comment Utility
no objections.

Zvonko
0
 

Accepted Solution

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

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

763 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

7 Experts available now in Live!

Get 1:1 Help Now