11 Replies Latest reply on Mar 24, 2017 12:50 PM by MarkWalsh

    Debugging Javascript on IOS

    MarkWalsh Level 4

      I'm having problems with a PDF form in Acrobat Reader on IOS. There's a function to set a checkbox value based on which range a field's value is within. There are 3 ranges (55 or less; more than 55 up to 85; more than 85). The corresponding values in the checkboxes are 'A', 'B', 'C' (they originally had the range description, but I simplified it to a single letter for debugging purposes). If the value is 0 then I set the checkbox to 'Off'


      Everything works properly in acrobat, but on IOS, it seems to be completely intermittent. I added a field to create my own 'debugger' on iOS, and I'm populating it with the values that of the field, the range value that needs to be set in the checkbox, and the actual value of the checkbox.

       

      Value: 60

      Range Value: "B"

      Checkbox Value: "B"

       

      Each line is added to the text field right after the variable or checkbox value is set in the function. On IOS, the checkbox is either getting set to 'Off' despite the fact that the range value is 'B' (or whatever the actual value is), and sometimes it will show a completely different value than the variable it's getting set to:

       

      Value: 60

      Range Value: "B"

      Checkbox Value: "A"

       

       

      This is the code I am using:

       

      ...

      debugText = debugText + 'Range Value: "' + rangeValue + '"\r'

      CheckboxField.value = rangeValue

      debugText = debugText + 'Checkbox Value: "' + CheckboxField.value + '"\r'

      ...

       

      So I don't understand how the checkbox could be 'A' when it gets set to 'B' in the line of code directly before it. This was the first thing I typed in when I opened the empty PDF on the iPad, so it can't be picking up an old value. If anything, I could at least understand if the checkbox value was 'Off', since it was an empty form and that was the value before I started typing.

       

      I have tried activating the code in the field's 'Blur' event, 'Calculate' event, and 'Validate' event, and neither  seems to work.

       

      Unfortunately, I can't debug easily on IOS, I have to keep updating the file on my computer, uploading it to the iPad, then testing, which is extremely time consuming. Is there any way to remotely debug a PDF on IOS, or does anyone have any idea why this isn't working, or what I can do to make this work.