Solved

Calculate text fields based on listbox choice

Posted on 2004-04-22
6
442 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

737 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