Adobe Acrobat 5: addWeblinks()

I added the method addWeblinks() to a text field (as JavaScript):
var numWebLinks = this.addWeblinks();
When moving to another field (onBlur), Adobe messages 'Creating weblinks' in the status bar.
Unfortunately, weblink is not created (at least not visible and functional). The content of the field is "http://www.google.de".
How to get it run?
go4javaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Karl Heinz KremerCommented:
The Doc.addWeblinks() method works only on "real" PDF content, and not form fields. What are you trying to accomplish (be as specific as posible)?
You may be able to use a different methanism to create the same effect (e.g. create a button that opens the selected URL).
0
go4javaAuthor Commented:
I've a form with various input fields. One is a TEXT field to keep a specific URL, entered (copied) by the user.
After leaving the field, it should automatically convert to a hyperlink, so that following users can simply click on the URL.
0
Karl Heinz KremerCommented:
It's not possible to do this in a one-step solution. First of all, this would only work with the full version of Acrobat (you need to modify the document and save it again, which is not possible in the free Reader). YOu also need to convert your field from a text input field to a link, which would mean that you can not update the link anymore once you've converted it to a link.
How about using two different form fields: One for the input, and one for the actual link? This way you can modify the document, and still modify the link if that's necessary.

Can you provide more information about what you want to accomplish with this? It sounds like you have two different user types for your document. There may be other ways to accomplish this, please provide as much inofrmation as possible.
0
go4javaAuthor Commented:
We are working with Acrobat 5, not the reader. Reader is for end-users only.
Soon, we'll get Acrobat 6...
If I follow the steps mentioned on top, the function seems to process (but the field will not be converted to a link - as it should).
The field with the link will be submitted and some other users will add more information to the form (each of them will submit accordingly).
Can't use 2 fields, one is a must...
0
Karl Heinz KremerCommented:
Your assumptions are wrong: The function is not supposed to convert a text field content to a web link.

Use this script as OnBlur action handler for your text field (you need to change the field names Text1 and potentially Button1 if you already use a field named "Button1"):

var f1 = this.getField("Text1");

// get the size and coordinates for Text1
var r = f1.rect;
var url = f1.value;

if (typeof f1.page == "number")
    var page = f1.page;
else
    var page = f1.page[0];

// set the text color to blue (to mark it as a link)
f1.textColor = color.blue;

// create a new button
f2 = this.addField("Button1", "button", page, r);

// set the action of the button to "go to URL"
f2.setAction("MouseUp", "this.getURL('" + url + "', false);");

// end of script

This will create a new button with an action of "getURL()" right on top of the original text field. This way, the button will be clicked when the user clicks on the text field. I'm also changing the color of the text in the text field to blue so that it looks more like a link.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.