Please check out the help article https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/js_developer_guide.pdf and see if that works for your.
Hope it will help
You're asking for different things, not just one script.
For example, I would begin by leaving the first input field fillable, and the second field readonly.
Then you may employ a custom keystroke script in the first required target field with a conditional statement to handle the part that the value is equal, greater or lesser than 0.
You may also want to add a condition to make the second field editable again if the values of the first field meet the criteria indicated by the script.
Employing the use of an alert is not necessarily required to remind the user that they missed to fill in the first field if you do it like this.
But yes you may add an alert to remind them just in case they move to other parts of the form without entering a value in the first field.
How are you sure they will click in first field? and why would they click in first field and then tab out to next field whitout filling it first?
It's a very bad user experience to be "locked" into a field like that. I would recommend you use some other way of making sure they enter a value into that field.
Maybe I don't need to make it a 'requirement' for the user. Here's the issue: I have fields that calculate from input. For whatever reason, if nothing is in a field that is part of a calculation, the calculation does not work 100%. For example, users enter numbers into field 1, field 2 is 'optional' as it may or may not apply to them, and field 3 calculates the difference between the 2 fields. Field 3 calculates correctly. Field 4 uses the number in field 3 and multiplies it by a percentage. This works correctly. However, field 4 is used in another calculated field, field 8, further down the page. Field 8 adds field 4 and field 7. Field 8 will not add field 4 to it unless a zero is filled into fields 2 and field 6. I've tried putting a default value of '0', but it doesn't seem to make a difference. See below: line 9 should be adding lines 4 & 8, and it is set up to do this in properties, but it doesn't calculate unless something is entered in lines 2 and 6. ???? I'm sure I'm doing something wrong. This is the first time I've worked with adobe acrobat forms so I'm learning as I go. Thanks for your input and help.
Check 'field calculation order', in 'prepare form' click on 'more'-> 'set field calculation order' and make sure on top is field that calculates first, it should look something like this:
If that doesn't help, upload your file here so we can take a look.
Thank you! That fixed my problem! I missed the 'more' option and frankly didn't know it was there. I'm glad I didn't need to go the route of required fields etc. Thanks again! Truly appreciate your assistance!