These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

creating a search field in a form

DTjava
Registered: Jun 17 2011
Posts: 21
Answered

Hi everyone,
 
Need some help regarding PDF search functions.
 
Basically the goal is to have a text field on the main form where a user can fill out and hit "search" to look for that text in the document.
 
"Wait!" you say, "Acrobat already HAS a search function!"
 
You are correct, but we have to assume our user base has zero experience with acrobat. That's why I need the search field front and centre, in the middle of the page, surrounded by our friendly form.
 
I have 2 ideas:
 
Have a textfield and button that populates and activates the search function all in one go. So if I typed in "fruit" in the form, hit my custom "search" button, it would open the search tool, enter "fruit" and search the document automatically. The user would then continue using the search window, now that it's open and they know it's there...don't know if I can do that though through javascript.
 
Second idea is to somehow use acroexch and the findtext string to create an ad-hoc search within the document itself, bypassing the native search feature. Seems like a shame to NOT use the search function that's already built into acrobat, but if it means the customer will use it...
 
If anyone has any code they can share, or any other ideas on how to approach this issue, I'd be most grateful. Thanks for your support!
  
D.

My Product Information:
Acrobat Pro 9.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
It's not possible to script searching using the simple search field (the one you get when you press Ctrl+F), only the advanced one, using this code:

search.query("What We Want To Search For", "ActiveDoc");

You can set the various properties of the search object to affect case-sensitivity, etc.
But to be honest, I think this is ridiculous. Teaching your users how to use the built-in search function is a much better solution, and will probably take you much less time and effort to implement.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

CAMM
Registered: Nov 3 2010
Posts: 11
Hi DTJava,

I've had similar situations with inexperienced users of something new we were rolling out and we've had good results with using colorful (obvious) arrows and direction/help boxes to get them on their way. Might be easier than reinventing the search wheel? OF course, you know your user base better then the rest of us.......

Good Luck

CAMM

DTjava
Registered: Jun 17 2011
Posts: 21
I absolutely agree that it is ridiculous - However our tests show that optimal workflow from new users comes from having the search field right in front of their nose, with our copy leading the eye and hand to the next stage of navigation. It's going to be in multiple languages as well, so english based instructions may not have the effect we are looking for.

That said, I think the best way to educate is to force someone to grow. My best solution so far is to use the search.query function (thank you try67!) at the start, using a get on a "search" text field we put on the first page. That will kick our user into acrobat's search function, and find the first instance of the term they were looking for. This should then lead them to use the acrobat seach feature for the remainder of their stay.

Failing that, CAMM's idea of graphical based instructions is the way to go. With the correct icons, it should transcend language.

Thank you both! This community never fails to impress.

D.