Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Windows/ipad different code behaviour

Community Beginner ,
Oct 03, 2021 Oct 03, 2021

Hi I am noticing different behaviour on my ipad vs my windows machine  on some code I created.  This gives text a numeric value and adds them up.  The pic below is on my windows machine which assigns a value of 1 to the text in the colums and places it on the bottom. 

code.pngexpand image

 

This shot below is on my ipad which does nothing at all!  I a bit confused as to why? 

 

File_000.pngexpand image

 

my code is below, which works well, (it just  adds up the texts boxes)

 

var fields = ["Text1", "Text2", "Text3", "Text4", "Text5", "Text6", "Text7", "Text8", "Text9", "Text10", "Text11", "Text13", "Text14", "Text15", "Text16", "Text17", "Text18", "Text19", "Text20", "Text21", "Text22", "Text23", "Text24", "Text25", "Text26", "Text27"];

var count = 0;

for (var i=0; i<fields.length; i++) {

var f = this.getField(fields[i]);

if (!/^\s*$/.test(f.valueAsString)) count++;

}

event.value = count;

 

Wondering if anyone has some ideas? thanks!

 

 

TOPICS
Create PDFs , How to , JavaScript
826
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 03, 2021 Oct 03, 2021

Acrobat Reader for iOS and Android doesn't support all javascript features.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 03, 2021 Oct 03, 2021

Don't use "f.valueAsString" in your evaluation script.

 

Instead of using this line:

 

(!/^\s*$/.test(f.valueAsString))

 

change it to:  (!/^\s*$/.test(f.value))

 

In addition, as mentioned by Bernd Alheit, some features may not work in the  iOS or Android mobile versions of Adobe Reader.

 

Even though the form may calculate correctly with the change in the script suggested above, the built-in "Reset" feature, for example, won't clear the fields automatically.

 

You need to add a "MouseUp" trigger event button with a "Reset a form" action for your users.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 04, 2021 Oct 04, 2021

Thanks for your help! I am having another issue as you can see in the video.  My checkboxes add up in the total box but the text does not until the second piece of text I add in.  So it is not registering the first text I add.  Not sure why?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 07, 2021 Oct 07, 2021

Check the fields calculation order.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 12, 2021 Oct 12, 2021

That did it! Thanks! I re-arranged the order with the text box sum 1st.  Just wondering why that matters as I had the text box 3rd in order before?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 14, 2021 Oct 14, 2021

You're welcome. Happy to read that you were able to get it to work.

 

There is a good explanation on why the field calculation order matters here:

 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 26, 2021 Oct 26, 2021
LATEST

Hi the behaviour has gone back to the way it was https://www.loom.com/share/3f060e7da0764a3aa70d8ec10ae6f640

Not sure what is going on here? thanks for any help.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines