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

Custom Validation Script - Page Jump When "event.rc = false"

New Here ,
Sep 14, 2020 Sep 14, 2020

Copy link to clipboard

Copied

Hi all and thank you for looking.  I'm experiencing a peculiar issue with a custom validation script where anytime event.rc is set to false upon validation failure, the page switches to the first page in the document. 

 

Background:

5 page document, relatively field heavy on all pages except the first one (intro, instructions, etc).

There are a series of date fields each of the subsequest pages.  Each one has the exact same generic validation function (event is passed into it).  Upon failure of date validation and when the function sets event.rc to false, the document returns to the first page (always).  Oddly enough, this only happens from the second page in the document.  When the same validation script sets rc to false on pages 3, 4, and 5, the document stays put on that page.

 

I've removed any calls to functions from custom validation and simply set "event.rc = false".   Sure enough, when this is done on page 2, the document scrolls up to page 1.  All subsequest pages are fine.  Calling "event.rc = true" (i know, redundant) does not cause the page to scroll back up.

 

I am definitely out of ideas and would appreciate and and all suggestions.

 

Thanks again

TOPICS
Acrobat SDK and JavaScript

Views

631

Translate

Translate

Report

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

correct answers 1 Correct answer

New Here , Sep 14, 2020 Sep 14, 2020

Thank you kindly for your reply ls_rbls.  I considered this and this is why I removed all script and only left "event.rc = false" in there to rule out anything in the actual script.  I should have noted that do not have any explicit page moves in any of the validation scripts.

 

On a positive (and a weird note), I just got done recreating the document via a page import. So basically, I created a new document and imported all the pages from the non-working one.  Lo and behold, everyting works.  I h

...

Votes

Translate

Translate
Community Expert ,
Sep 14, 2020 Sep 14, 2020

Copy link to clipboard

Copied

Perhaps you cam share a portion of your script.

 

It may be possible that you're missing a conditional statement for the validation script that runs in the date field of Page 2, OR, check for a typo, OR, check if that date field is also dependent of other calculated fields, and/or re-verify if the zero-based index for the page number corresponds to the actual page number that you're seeing on screen.

 

I JavaScript, the first page of a document begins at "0", not "1".

Votes

Translate

Translate

Report

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
New Here ,
Sep 14, 2020 Sep 14, 2020

Copy link to clipboard

Copied

Thank you kindly for your reply ls_rbls.  I considered this and this is why I removed all script and only left "event.rc = false" in there to rule out anything in the actual script.  I should have noted that do not have any explicit page moves in any of the validation scripts.

 

On a positive (and a weird note), I just got done recreating the document via a page import. So basically, I created a new document and imported all the pages from the non-working one.  Lo and behold, everyting works.  I have come across something similiar in the past where re-importing pages made things right.  The reason I did this was I went back to a document backup from a few days ago.  Same script, no page jumps.

 

Anyway, I'm half happy half disturbed but at least I can move on.

 

Thank you again for taking the time to do this.

 

Votes

Translate

Translate

Report

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 ,
Sep 15, 2020 Sep 15, 2020

Copy link to clipboard

Copied

I see that you solved it, but I would like to venture a guess as to why it happened, just in case it happens again to you (or to someone else reading this thread). Is it possible that there are was a copy of this field on the first page? If so, when the command to reject the value was issued and return focus to the field, it could have been that the first "widget" (member of a field group) was selected, instead of the one you were actually editing, which is why it jumped to another page.

Votes

Translate

Translate

Report

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 ,
Sep 15, 2020 Sep 15, 2020

Copy link to clipboard

Copied

LATEST

I created a test file and can confirm that is indeed the issue.

Votes

Translate

Translate

Report

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