Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - App.Alert function help needed
  FAQ FAQ  Forum Search   Register Register  Login Login

Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

App.Alert function help needed

 Post Reply Post Reply
Author
Chandra View Drop Down
New Member
New Member


Joined: 24 Jan 2014
Points: 2
Post Options Post Options   Quote Chandra Quote  Post ReplyReply Direct Link To This Post Topic: App.Alert function help needed
    Posted: 24 Jan 2014 at 8:42pm
I have a timesheet form that I have prepared. The timekeeper enters hours worked and the form calculates the hours absent. If the hours worked is less than 7.5 hours, the form should prompt the timekeeper to select an absent code from a drop down box. If the timekeeper later changes the hours worked to more than 7.5, the absent code should be reset to the default value, which is " ".

The code I have entered on blur is:

a = this.getField("HrsWrkdMonday").value;
b = this.getField("AbCodeMonday").value;

if (a<7.5 && b===" ")
    {
    b.setFocus()
    app.alert("Please enter Absent Code for Monday.")
    }
else if (a>7.5 && b!=" ")
    {
    b=" "
    }

Any assistance would be greatly appreciated.
Back to Top
try67 View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Points: 634
Post Options Post Options   Quote try67 Quote  Post ReplyReply Direct Link To This Post Posted: 25 Jan 2014 at 10:14am
It will help if you say what the actual problem is...

I do see several issues with your code, though:
1. To access the value of the field you're exiting from you should use event.target.value.
Better yet, use a Validation code and then access "event.value".
2. You're trying to call setFocus() on a string (the variable "b"), instead of on a field.
3. You need to assign a value to a field directly.
This line will not change the value of the field:
b=" "
It will only change the value of the b variable.


Edited by try67 - 25 Jan 2014 at 10:14am
- Acrobat Expert - Contact me personally at try6767@gmail.com
Check out my custom-made scripts website: http://try67.blogspot.com
Back to Top
Chandra View Drop Down
New Member
New Member


Joined: 24 Jan 2014
Points: 2
Post Options Post Options   Quote Chandra Quote  Post ReplyReply Direct Link To This Post Posted: 27 Jan 2014 at 5:58pm
Thanks for the reply and my apologies for not being more specific. I am new to javascript and have been able to piece together what I have found in the forum to create a timesheet. The form requires the timekeeper to enter the total hours worked for a specific day (i.e., Monday, Tuesday, etc.). The field name for this field for Monday is "HrsWrkdMonday". If the hours worked are less than a full work day (7.5 hours) the form calculates the hours absent (HrsAbsentMonday); if the hours worked are more than a full work day the form calculates the hours of overtime (HrsOTMonday). The form then calculates the totals for each of these for the week.

I have created a dropdown list of applicable absent codes. If the hours worked are less than 7.5 (and therefore the hours absent is greater than 0) I would like to have an app.alert command to tell the timekeeper they must enter an absent code. The form should then highlight the absent code field for the user to select one from the drop down box.

Additionally, if the timekeeper then goes back and changes the HrsWrkdMonday to greater than 7.5 the AbCodeMonday should be set back to the default value of " ". I would suspect the javascript would go in the AbCodeMonday field; Action->On Blur->Run a JavaScript.

Thank you for the time (and patience).
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.047 seconds.