Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

In Document Linking - SetFocus

Avatar

Level 2

I'm building a document for a client and I'm using a SetFocus button to go from the top of the form to the bottom of the form.  However when you click the button and are brought to the bottom of the document the SetFocus location is sometimes at the bottom of the view.  Is there a way to set the view so that the destination I'm trying to link to is always in the center of the users screen?  Attached is the document and click the blue question mark next to "What is the nature of the business?" for any example.  Thanks.

 

https://www.dropbox.com/s/n9t8iqcuyxnf2u4/Due%20Diligence%20Questionnaire%20-%20Retirement-mkv10.pdf...

15 Replies

Avatar

Level 10

Hi,

You can probably use the doc.scroll method to do what you want.  There's an example here Adobe LiveCycle Designer Cookbooks by BR001: Using the Doc.scroll method in a LiveCycle Designer For....

I've updated your form to use the doc.scroll so what you are linking to is always at the top of the screen, which is were I would assume the user would start reading from. https://sites.google.com/site/livecycledesignercookbooks/home/Due%20Diligence%20Questionnaire%20-%20...

(I've only changed a random selection of your links ... the first few the last few and the one you mentioned in your post).

The advantage of doc.scroll is you don't have to specify a input field, you can scroll to a text object.  If you want to position the text in the middle there are methods to access the users view area dimension.

Regards

Bruce

Avatar

Level 2

Bruce,

Thanks for the reply.  Do the results vary based on the zoom level of the document, which I think is similar to SetFocus?  It appears that I get different results with different zooms.  Targeting "What is the nature of business?"

100%

887064_pastedImage_0.png

vs 125%

887065_pastedImage_1.png

If that is the case, unfortunately this method may be just as effective as SetFocus.  I apologize if I'm missing something.  Fairly new to Adobe LiveCycle Designer.  Thanks again for responding and being willing to help!

Avatar

Level 10

Hi,

I've just tried my sample in Reader 9, XI and DC and it's gone to the correct position in the document.  Maybe I'm misunderstanding the problem.  The setFocus method will try and position the field in the middle of the screen, but will also try and not leave any blank spaces below the field ... so maybe lower at the end of the document.

There's an example here, Adobe LiveCycle Designer Cookbooks by BR001: Season Planner (or Year Planner) PDF Template, of using a subform as tooltip, so you have more control over the content and formatting, which may also be an option in your case.

Bruce

Avatar

Level 2

Bruce,

Thanks again for the reply.  I'm actually going to give your solution an attempt and maybe just move the destinations around a little bit so that the text isn't cut off from the toolbar.  Unfortunately since I'm a bit new to Adobe LiveCycle Designer, I'm having a bit of difficulty replicating your solution.  I noticed the new code "XFAUtil.scrollTo" but I'm having issues implementing the rest of the solution.  It appears that you also created a new page "FormCalc" and stored some variables on this page.  Is there an easy way to reproduce those variables that you leverage?  Unfortnutely I don;t believe the I can copy and paste and I'm not able to see the variables you used through the "File->Form Properties" option.  I apologize for being such a beginner but all of these things are new to me.  Any advice you could provide would be great!  Thanks.

Avatar

Level 10

Hi,

I hadn't realised that the FormCalc page couldn't be copied from my sample.  Seems you can't copy it when it's been hidden, changing the presence to visible allows you to use the Edit ... Copy option to get it into your form.  Variables can be added to any subform, just not with the Designer UI which only supports adding them to the top most subform. These are just for the internal use of the FormCalc page, there's a description here ... Calling FormCalc Functions From JavaScript you shouldn't need to worry about them.  Then just change the setFocus call to XFAUtil.scrollTo.

Bruce

Avatar

Level 2

Bruce,

Thanks for the continued help.  I've gotten closer, but unfortunately I still haven't implemented it correctly.  I've tried to make the change to the "section_1_customer_information_question_mark_button" within "Addl_Cust". Attached is the latest version of my file.

Dropbox - Due Diligence Questionnaire - Individual-mkv5.pdf

Also I'm a little concerned that changing the language to "FormCalc" that will break the rest of my Javascript code I'm using on the same button.  Sample code for that is below:

//Hide Other Instances

HelpText.HelpText.legal_name.fillColor = "255,255,255"; HelpText.HelpText.legal_name.border.edge.presence = "hidden"; HelpText.HelpText.address.fillColor = "255,255,255"; HelpText.HelpText.address.border.edge.presence = "hidden";

Any additional guidance you can provide would be great.  Thanks.

Avatar

Level 2

Also is there any way to add some additional padding so that the text isn't cut off by the tool bar in some instances.  Like the attached.

Untitled.png

Avatar

Level 10

Hi,

The XFAUtil.scrollTo(...); line is JavaScript so you don't need to change the script language.  You just needed to copy the XFAUtil script object across.

I've done that now and the updated version is;

https://sites.google.com/site/livecycledesignercookbooks/home/Due%20Diligence%20Questionnaire%20-%20...

If you look at the XFAUtil script object with the script editor in Designer you will see on line 26 "event.target.scroll(0, yCoord + 10);"  I was just playing around with the + 10 to give you some padding (normally I just use event.target.scroll(0, yCoord );, anyway if you want more padding just increase the number 10 to whatever suits.

Bruce

Avatar

Level 2

Bruce,

Thanks.  I think I've figured it out well enough now to replicate to the other files.  However I do have one last question (hopefully it's my last question).

I noticed a potential issue.  I've uploaded a video to YouTube to help me describe the issue.

AutoScreenRecorder 03 Feb 27 15 06 - YouTube

When I open the document and use the zoom to view/access the question marks (instead of scrolling the document) the buttons don't seem to work.  Well most of them, for some reason the first question mark in the section works but not the field level items.  Notice the scroll bars movement after I dismiss the not able to save warning after clicking the "Legal Name" button for the first time.  However if I scroll down to the question marks the buttons work on the first pass.  Any thoughts to why this may be happening and if it can be resolved?  Just want to provide the best customer experience for my end users as possible.

Thanks again for all the help thus far.  This is a HUGE improvement over how Adobe solves this problem.  Not sure why they software has such basic limitations.

Michael

Avatar

Level 10

Hi Michael,

I think this might be a because zooming in has brought the bottom of the form in view and Reader will try and keep as much of the form in view as it can.  If you add a blank page it should work as expected.  Not sure how to work around it besides adding a blank page.  You do have some code in the click event which is hiding objects this also could confuse the scrolling, but I think it's an end of page thing.  Do you think people are going to scroll in far enough for this to be a problem, I had to get to about 50%.

Bruce

Avatar

Level 2

Unfortunately adding a blank page did not resolve the issue - Dropbox - Due Diligence Questionnaire - Individual-mkv5.2.pdf

It may not be an issue, but if the user is zoomed out enough that they can see the question mark buttons without scrolling it will create the issue.  It may not happen often, but its hard to implement if it possess a potential issue.

Avatar

Level 10

Seems when zoomed out to 50% you need 2 blank pages, https://sites.google.com/site/livecycledesignercookbooks/home/Due%20Diligence%20Questionnaire%20-%20...

If you zoom out to 25% you need 4 blanks pages.

In the XFAUtil script object before the line "event.target.scroll(0, yCoord + 10);" you could add "event.target.zoom = 100;", which would set the zoom back to 100.  I think you could justify this as few people would be able to read the help text when zoomed out anyway?

Bruce

Avatar

Level 2

Unfortunately that doesn't seem to have worked either.

https://www.dropbox.com/s/xf1z7w3qs4zy2tl/Due%20Diligence%20Questionnaire%20-%20Individual-mkv6.pdf?...

Is that code setting the zoom based on the click?  Would it be better to set zoom when the document is opened?  Thanks.

Avatar

Level 10

Hi,

Your version 6 still has the hide code in the click events, please have a look at this version https://sites.google.com/site/livecycledesignercookbooks/home/Due%20Diligence%20Questionnaire%20-%20...  This has all the other hide code in the question mark button removed as well as setting the zoom level.

You can set the zoom level when you open the document, I generally set it to 96.4% which stops the default of fit width, which on a wide screen makes it look like you are looking thought a letter box, Adobe LiveCycle Designer Cookbooks by BR001: Adobe LiveCycle Designer Tip #1

Bruce

Avatar

Level 4

Has anyone got this to consistently work when the scroll is on a different page than the button? I find when scrolling to another page, it sometimes does not work.