Expand my Community achievements bar.

Links Within PDF

Avatar

Former Community Member
I need a way to add links within a PDF.



This would react similar to Adobe Acrobat's settings, but I need a solution using LiveCycle Designer (7.0).



Any help would be greatly appreciated.
100 Replies

Avatar

Former Community Member
Mary,



Don't worry about asking questions. This is what the forum is for and it's what I'm here for as well!



After reading a few lines of your message, I'm thinking it would be best if I was looking at the same form you're talking about.



If you don't mind, please send it to me at formbldr@adobe.com (since you don't have the authority to post attachments to these forums) with an email entitled "Links Within PDF" and we'll go from there.



Thanks,



Stefan

Adobe Systems

Avatar

Former Community Member
Mary,



Thanks for sending me your form. It's a lot easier now to understand what you're talking about in your last post.



There are a few things that need to be done in order to achieve the functionality you're after so I think it would be best to do things in steps.



First of all, I'd like to clarify a few things about writing JavaScript:



On the "yes" buttons, you have script like this:



if (TextField66.rawValue != yes && TextField66.rawValue.length > 0 Then TextField102.rawValue != MarioRamos && TextField102.rawValue.length > 0)


There are a number of things that need to be corrected:







  • In JavaScript, there are 3 basic types (variables): Numbers, Objects and Strings. When you're comparing the value of TextField66 to
    yes, you're comparing to the
    String "yes" and therefore you need to enclose "yes" in double-quotes or else you'll get a script error because
    yes isn't some type of variable.





  • The goal is to lock TextField66 and TextField102 and assign the person's name to TextField102. Therefore, I believe what you're trying to do (based on the invalid
    Then keyword in JavaScript) is ensure that the person has provided their name in some field on the form prior to clicking the "Yes" button. In this case, you're simply trying to say, "if the field (TextField66) hasn't been locked with either 'yes' or 'no'
    and the user has provided their name, then lock the field with either 'yes' or 'no' and include the user's name in the pertaining summary field (TextField102)".





Given these corrections, the IF statement should now look like this:



if ( (TextField66.rawValue == null) && (UserName.rawValue != null && UserName.rawValue.length > 0) )


(
UserName would be the new field in which the user would be required to enter their name prior to being able to lock any fields.)



The next thing to do is fix the locking mechanism to work within your form. This means that instead of using a new check box named "Lock" for each "approvement" field (like TextField66), we'll use the actual "approvement" field as the field containing the lock value of either "yes" or "no". If the field is empty (null value), it'll signify that it hasn't been locked yet by anyone.



This change means that we'll remove the following script:



Lock.rawValue = "1";


and replace it with:



TextField66.rawValue = "yes";


The next step is to add the UserName field to the form so that we can get the user's name to put into the summary field for this particular "agreement" (TextField102). This will require that we add the following line after the locking line above:



xfa.resolveNode("F.#subform[3].TextField102").rawValue = UserName.rawValue;


Finally, we want both the "yes" and "no" buttons to disappear once the fields have been locked so you'll need to modify the
app.setTimeOut statement to hide both buttons:



var sHideScript = "this.getField('F[0].P2[0].Button12[0]').hidden = true;" + // hide the "yes" button

"this.getField('F[0].P2[0].Button13[0]').hidden = true;"; // hide the "no" button

app.setTimeOut(sHideScript, 10);


You may also want to change the
app.alert error message in the ELSE clause to state that the UserName field must be filled prior to being able to lock "agreement" fields and that locked fields can't be modified once they've been locked.



Give this a shot -- just for the TextField66 and TextField102 case for now -- and let me know how you do. Once that works, we'll proceed to the next step.



Stefan

Adobe Systems

Avatar

Former Community Member
I think I typed it in correctly but nothing happens when I click on it in the pdf form. I changed the buttons to radio buttons prior to getting your answer. (Bosses request). And I changed the field name from UserName to ApproverName. Does that matter? Did I not do it

right?

I only applied the new script to the Yes radio button associated

with TextField66. I didn't apply it to any others until we make sure it's working.

The script now looks like:

if ((TextField66.rawValue == null) && (ApproverName.rawValue != null && ApproverName.rawValue.length > 0) )

{

// "lock" the fields

TextField66.border.fill.color.value = "230,230,230";

TextField66.access = "readOnly";

ApproverName.border.fill.color.value = "230,230,230";

ApproverName.access = "readOnly";



// save value of lock

TextField66.rawValue = "yes";

xfa.resolveNode ("F.#subform[3].TextField102").rawValue = ApproverName.rawValue;

// make the lock button disappear after some time

var sHideScript = "this.getField('F[0].P2[0].Button12[0]').hidden = true; "+ // hide the "yes" radiobutton "this.getField('F[0].P2[0].Button13[0]').hidden = true;"; //hide the "no" button app.setTimeOut(shideScript, 10);

else

{

app.alert("Please sign the Approver Name box at the top of this Page prior to Applying your Approval or Disapproval. Once you have approved this form these fields cannot be modified.");

}

Mary

Avatar

Former Community Member
It sounds like your boss wants the user to have the ability to "revoke" the lock they've placed on an "agreement" field and therefore the "yes" and "no" radio buttons shouldn't be hidden once the lock is set. That means that we can remove the script related to the
app.setTimeOut statement (approx. 3 lines). It also means that there really isn't any use for the TextField66 field anymore since the radio button list will hold the "yes" or "no" value.



Now the fact that you're using radio buttons instead of separate push buttons changes things a little because you're now dealing with radio buttons inside an
exclusion group (or a radio button list as we like to call it in Designer's UI). The consequence is that the script that was in the "yes" button's Click event should move to the radio button list's Click event and the script we'll code later for the "no" case will also go into the radio button list's Click event.



Therefore, your script should look like this now:



if ((TextField66.rawValue == null) && (ApproverName.rawValue != null && ApproverName.rawValue.length > 0) )

{

// "lock" the fields

TextField102.border.fill.color.value = "230,230,230";

TextField102.access = "readOnly";

ApproverName.border.fill.color.value = "230,230,230";

ApproverName.access = "readOnly";



// save value of the approver's name in the pertaining approver summary field

xfa.resolveNode ("F.#subform[3].TextField102").rawValue = ApproverName.rawValue;

}

else

{

app.alert("Please sign the Approver Name box at the top of this " +

"Page prior to Applying your Approval or Disapproval. Once you " +

"have approved this form these fields cannot be modified.");

}


Note that I added two lines that disable (lock) the TextField102 approver summary field that were missing.



Give that a try. The effect should be that when you click on either the "yes" or "no" radio button, the TextField102 and ApproverName fields get locked and filled accordingly.



We're not done yet but try this for now and let me know how it works out.



Stefan

Adobe Systems

Avatar

Former Community Member
Not necessarily revoke the "lock." He wants any user to only be able to "sign" one field (thus the radio buttons)and then that field is locked so no one else can change it. He would prefer to assign passwords to each of the "agreement" field so that they are locked, unlocked, and locked again by only authorized users.

This is my work around to that. The password stuff is way out of my league.



I will try this and get back to you.

PS: Any idea why after working on the form in adobe designer, closing adobe designer now the form cannot be opened. It says there was an error in the email and some text didn't get coded. I didn't click the submit email button.

I can't import it either.

Avatar

Former Community Member
OK, we can do that. If you ever decide to tackle the password thing, we can do that to but I think it's best if we set that aside for now.



So, if the user can't revoke the lock (currently, anyway), you'll also want to lock the radio buttons in the radio button list. You can do this in the same way that the TextField102 and ApproverName fields are being locked.



Now as for doing something in Designer, closing the application and then not being able to re-open the file, that's something I've never heard of. If you still have the file in its "broken" state, could you send it to me (formbldr@adobe.com)? I'd like to have a closer look at it.



Stefan

Adobe Systems

Avatar

Former Community Member
I have applied the script above using ApproverName instead of UserName. I added a text filed which in the Object pallette I labeled "ApproverName."

When I open the form, type in a name(or not) and click "yes" nothing happens.

But the script is attached to the yes button just like you suggested.

Mary

Avatar

Former Community Member
Is it possible that the script
language in the radio button list's Click event is set to FormCalc? If not (because it should be set to JavaScript), when previewing the form, click in the ApproverName field and press "Ctrl + J". That should bring-up the Acrobat JavaScript Console -- see if there are any errors there. A script error would prevent the execution of the script past, and including, the line at which the error was found.



Stefan

Adobe Systems

Avatar

Former Community Member
In the Object Pallete there are two boxes. One is Validation Pattern Message and the other is Validation Script Message.

On both the radio button and the ApproverName fields the Validation Script Message Error box is checked.

If i click in the ApproverName filed and press "Ctrl+J" nothing happens.

When I click on the radio Button sometimes the Show list (to the left of the JavaScript area - is this the same as the "radio button list's Click event?") says initialize or preSubmit. I have to manually change it each time to the *click event to see the script. (when I do change it to *clik the "Language" is set at JavaScript and the "Run At" is set to Client.

Maybe there is something I'm not assigning?

Pressing "Ctrl+J" did not bring up a JavaScript Console or error messages.

Sorry, Stefan, it appears I am lost again.

Mary

Avatar

Former Community Member
I FOUND IT! :-)

It was in professional, I was trying in designer.

The error message is:



SyntaxError: syntax error

17:XFA:F[0].PT1[0].RadioButtonList[0].#field[0]:click



Is something numbered wrong?

Mary

Avatar

Former Community Member
Yes, you had to be in PDF Preview in order to show the JavaScript Console -- I should've mentioned that.



So it appears you have a script error on a radio button's Click event.



First of all, the script needs to move to the radio button
list's Click event instead of the radio button's Click event. To do this, select all the script in the radio button's Click event and cut (Ctrl + X). Then, using the Hierarchy palette, click on the radio button list object which contains the radio buttons. This will select the radio button list. You should now be able to select the radio button list's Click event in the Script Editor and paste the script you cut out of the radio button.



I'm asking you to move the script because radio button's themselves are seldom scripted. The radio button
list which contains them is what's scripted because that's the field that ends-up contain the data for the exclusion group (list of mutually-exclusive radio buttons).



Second, count 17 lines from the first line of script and look at that line, the line above and the line below to see if you can spot an error like a typo ("syntax error" usually means a typo).



Stefan

Adobe Systems

Avatar

Former Community Member
if ( (TextField121.rawValue == null) && (ApproverName.rawValue != null && ApproverName.rawValue.length > 0) )

{

// "lock" the fields

TextField121.border.fill.color.value = "230,230,230";

TextField121.access = "readOnly";

TextField121.border.fill.color.value = "230,230,230";

TextField121.access = "readOnly";



// save value of lock

TextField121.rawValue = "yes";

xfa.resolveNode("F.#subform[3].TextField102").rawValue = ApproverName.rawValue;

// make the lock button disappear after some time

var sHideScript = "this.getField('F[0].P2[0].Button12[0]').hidden = true;" + // hide the "yes" button

"this.getField('F[0].P2[0].Button13[0]').hidden = true;"; // hide the "no" button

app.setTimeOut(sHideScript, 10);



else

{

app.alert("Once you have accepted or denied the Approval, this field can NOT be modified. Please enter your name in the Approver Name box at the top of this page prior to assigning "Yes" or "No" to this field.");

}



I'm not seeing a typo, did I not configure the script correctly?

(TextField 66 and 102 are now (Global)text field 121 so that whatever shows in the "Approval" box shows in the identical box on the Approval Summary Page. Isn't that the way to make them the same? Or can I leave them numbered different as a result of this script?)

Mary

Avatar

Former Community Member
Now I have a whole slew of errors. They're all on line 17, I think. They all look like the same error message too.



Stefan, I'm sorry I feel like I'm just making so many mistakes and causing more problems. Here are the error messages:



SyntaxError: syntax error

17:XFA:F[0].PT1[0].RadioButtonList[0].#field[0]:click

SyntaxError: syntax error

17:XFA:F[0].PT1[0].RadioButtonList[0].#field[1]:click

SyntaxError: syntax error

17:XFA:F[0].PT1[0].RadioButtonList[0].#field[0]:click

SyntaxError: syntax error

17:XFA:F[0].PT1[0].RadioButtonList[0].#field[1]:click

SyntaxError: syntax error

17:XFA:F[0].PT1[0].RadioButtonList[0].#field[0]:click

SyntaxError: syntax error

17:XFA:F[0].PT1[0].ApproverName[0]:click

SyntaxError: syntax error

17:XFA:F[0].PT1[0].RadioButtonList[0].#field[0]:click

SyntaxError: syntax error

17:XFA:F[0].PT1[0].ApproverName[0]:click

SyntaxError: syntax error

17:XFA:F[0].PT1[0].RadioButtonList[0].#field[0]:click

SyntaxError: syntax error

17:XFA:F[0].PT1[0].RadioButtonList[0].#field[0]:click

SyntaxError: syntax error

17:XFA:F[0].PT1[0].ApproverName[0]:click

SyntaxError: syntax error

17:XFA:F[0].PT1[0].RadioButtonList[0].#field[0]:click

SyntaxError: syntax error

17:XFA:F[0].PT1[0].ApproverName[0]:click

SyntaxError: syntax error

17:XFA:F[0].PT1[0].RadioButtonList[0].#field[0]:click

Avatar

Former Community Member
That's OK, Mary. I'm sure we'll eventually get through this.



I think we're getting mixed-up because I'm working with one version of your form and suggesting changes while you're make other changes on your end I'm not aware of so my instructions may not always fit what you're working with.



Could we stick with one version of the form and get it working? Afterwards, if your boss wants to make changes, it'll be easier to do because you'll have a solid base to work from.



Please send me the "latest" version of your form and let's just work on that one without making any more changes. Agreed?



Stefan

Adobe Systems

Avatar

Former Community Member
Agreed,

I will send the latest and greatest and we will go from there tomorrow.

Once again, I'm sorry and I won't make anymore changes other than what we discuss. You've been so nice to me and I feel so bad about all this.

Mary

Avatar

Former Community Member
Mary,



Now that we're synced-up with the same version of your form, I see we need to clean-up the radio button situation:



It seems that you've placed all radio buttons within one huge radio button list. The problem with that is that radio button lists are mutually-exclusive by nature. That means that when data is submitted, they're designed to retain a single value amongst all radio buttons in the group. It's obvious you have many separate groupings of radio buttons here so we need to create individual radio button lists for each group of radio buttons.



On the "page 2" subform ("Approval Point One"), we need to fix the radio buttons lists for the approval "yes/no" fields at the bottom so that they're like the "yes/no/na" groups above. So for each "yes/no" radio button pair, select the radio buttons, right-click with your mouse and choose, "Wrap in new Radio Button Group".



Once you've done this for all "yes/no" pairs, do the same for the "yes/no/na" sets and the "yes/no" pairs on the "page 3" subform ("Approval Point Two").



Also, once you've done all this, go back and specify values for each of the radio buttons in all groups. You can do this by selecting the group and using the
Specify Item Values check box on the Binding page in the Object palette. As you're specifying values for all the groups, make sure that for the "yes/no" groups, the "no" radio button has a value of "0" and the "yes" radio button has a value of "1". For the "yes/no/na" groups, make sure "yes" has the value "1", "no" has the value "0" and "n/a" has the value "2".



You can verify which radio button has which value by setting a default value on the radio button group. You can do this by using the
Default Value property on the Value tab of the Object palette. Make sure, however, that none of the groups have default values once you're done -- you're just using the Default Value property to verify that the radio buttons have the proper (expected) values.



Radio button values are important because one of those values will be submitted in the data when the user submits the form to the next participant in the workflow.



Let me know how this step goes.



Stefan

Adobe Systems

Avatar

Former Community Member
I will start working on this but it may be for naught.

I'm currently working as a temporary employee and it looks like a lay-off is looming. Possibly today, I don't know.

I am keeping everything you snet me and taking it with me so I have at least learned soemthing form this position.

In case I don't get a chance to say it later, Thank-you so much for all of your efforts!

Have a great weekend!

Mary

Avatar

Former Community Member
Yikes! That's a little disconcerting. I pray your position doesn't get cut after all this hard work!



Remember that this forum is free to all to use. You can always download a demo version of Designer at home if you want to pursue this topic -- and then maybe we can try something simpler and work-up to this more challenging task.



Anyway, let me know if you're still around. I'll be happy to keep working with you on this problem or answer some other questions.



Stefan

Adobe Systems

Avatar

Former Community Member
Ok,

Done asigning values and re-grouping. My only problem with the re-grouping is - I only want the user to be able to selct one yes/no button in the "Approval" area at the bottom of each page. After re-grouping the ones on the bottom I can select yes/no next to each name if I want.

What will happen if I change the grouping of the Yes/No buttons on the bottom of each page so they are grouped together in order to allow the user ("Approver") to only approve once?

Yeah, I know, the issues of being a temp. I know this is free and I will keep in touch if I get the opportunity to work in Adobe Designer again. I was enjoying learning something new!

Mary

Avatar

Former Community Member
So if I understand correctly, you want an approver to have one shot at approving or disapproving one thing amongst all approvable topics. Is that correct?



If so, then I see two options:







  1. Continue to make individual groupings of "yes/no" pairs for each approvable topic and then use script to disable and/or hide all others once the user picks one.





  2. Leave all the "yes/no" pairs in a single group but give each radio button in the group a specific value so that when the data is submitted, you're still able to tell which topic was approved and then what the decision was (yes or no).







Maybe you should just stick with the single exclusion group for all "yes/no" pairs. That will make things a little more simple.



Once you've done that (assigned a unique value to each radio button in the group), remove the Click event script from all radio buttons and place one copy of the script into the radio button group's Click event because when you're scripting with radio buttons, it's best to do it from the exclusion group rather than from individual radio buttons.



Stefan

Adobe Systems

Avatar

Former Community Member
They are not approvable topics. They are department names for each Approving Manager.

I will work on the Click Events.

I guess they are extending my contract for another position with the company so I will be back on Monday and working on this form in my spare time.

Mary