473,396 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

What is wrong with my script for an acrobat form?

Hi,
I am trying to complete a form in acrobat for my company, but this is the first time I have ever used javascript. Using google (and my knowledge of Maths and excel), I have managed to write script for most of the calculations I am performing. However, I am having trouble with the final calculation and would like someone to have a look and help offer me guidance on where I am going wrong.

Overview. My final equation, box z, will look at box A and identify which product has been selected from the drop down list. If the product is Apple, then box z will look at box b. If box b is =<0.7, then box z needs to show ‘overweight’. If box b is =>0.475 but <0.7, then box z needs to say ‘good weight’. If box b says >0.475 then box z needs to say ‘underweight’.
If box A does not say apple, then box z needs to be blank.

I have drafted the following code but it does not work. Any help from anyone?

Expand|Select|Wrap|Line Numbers
  1. if (this.getField("Box A").value == yes){
  2. Event.value=(this.getField(“Box B”).value={
  3. if (this.getField(“Box B”).value == =<0.7) {
  4. event.value=”overweight”;
  5. }
  6. Else if (this.getField(“Box B”).value == (=>0.475) && (=<0.7)) {
  7. event.value=”good weight”;}
  8. Else if (this.getField(“Box B”).value == >0.475) {
  9. event.value=”underweight”;}
  10. Else if (this.getField("Box A").value == no){
  11. Event.value=” “{
  12. Else if (this.getField("Box A").value == ){
  13. Event.value=” “}
  14.  
Jul 12 '10 #1
3 1642
acoder
16,027 Expert Mod 8TB
The JavaScript used in Acrobat is different from that used in a web page, but some of the basics are the same.

I'm going to assume that this.getField("Box A").value gets the value of the field "Box A". Then the first thing you need is to put quotes around "yes".

Line 3 should probably be
Expand|Select|Wrap|Line Numbers
  1. if (this.getField("Box B").value <= 0.7) {
There are a few other things, but that should get you started.
Jul 12 '10 #2
Dormilich
8,658 Expert Mod 8TB
don’t know if it matters, or if it comes from pasting the code, but in standard JavaScript ” and “ (typographical quotation marks) are not string delimiters.
Jul 13 '10 #3
Hi, thanks to you both for your feedback. I am a complete novice to javascript and simply wanted to build a form for work. In the end, I completed this task but rather than use the one long equation above, I decided to break it up and used multiple hidden fields to do simple equations to get to the result I wanted.

Many thanks again,
David
Jul 13 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Lee Redeem | last post by:
Hi there I've created abd uploaded this basic PHP script: <html> <head> <title>PHP Test</title> </head> <body> <H1 align="center">
4
by: Fang | last post by:
Hi, I'm new to PHP. I followed an example on the book and wanted to pass a variable from one html page to a php page, but it always tells me the passed variable is undefined. I've checked the...
0
by: DV | last post by:
Hello group, can anyone tell me whether the current FOPs can produce PDFs with real acrobat formfields (textboxes usw.) in it? 1. Does FO have language elements for this? 2. If not, has...
4
by: Semi Head | last post by:
Hello folks, I'm looking for a script to validate a specific number value in a standard form input field. An example would be, if someone enters a number into a form input, I want the script to...
3
by: John Smith | last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <div id="navcontainer"> <ul...
5
by: Werner Partner | last post by:
On my testpage http://www.sonoptikon.de/test.php I have this <table><tr> <td valign="top" align="center" style="width:150px;"> <form action=test.php method="get">
3
by: Nelson R. | last post by:
Hi, im using a form to get some input from the user. This form is in a HTML file. When I post the form directly to my email, i receive all fields correctly. Example test.html: <FORM...
2
by: abk | last post by:
how to make a script for form submittion in mdb file
12
by: Marc | last post by:
Comming from JSP-HTML when I hear 'script' I think of JavaScript or perhaps VBScript. But I think in ASP.NET they mean something else? I am bit confused now. Reading a book I see the following:...
3
by: muddasirmunir | last post by:
I am trying to give the following Icon in my form in vb6. http://www.mediafire.com/?ymzgkgyi50j But , when I put this in my form I got error "Invalid Picutre" What wrong in it? How to add...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.