Question Details

avatar
Welcome to the Acrobat Answers site. You're on your way! It won't take you many more points to reach the next level: Participant. And as you accumulate more points, you're also building your reputation with the community and with AcrobatUsers.com.

Dialog box user input checkbox to drive Dynamic Stamp checkbox

Hello to all, I have no JS knowledge whatsoever. Have been reading countless tutorials, guides and posts and have managed to create a "Dynamic Stamp" which prompts the user for certain information before it gets placed.

I just need help in passing the status/value of a checkbox within the javascript dialog box to the actual checkbox on the stamp. Any sort of help/comments would be greatly appreciated.

This is what my code looks like so far, sorry if its messy but this is what has resulted from scavenging the net:

var dialog = {
starValue: "",
mjValue: "",
accValue: "",
bChk1:false,
 bChk2:false,

initialize: function(dialog)
{
var dlgInit =
{
"Chk1": this.bChk1,
"Chk2": this.bChk2,

};
dialog.load(dlgInit);
},

commit:function (dialog) { // called when OK pressed

var results = dialog.store();
this.starValue = results["txt1"];
this.mjValue = results["txt2"];
this.accValue = results["txt3"];

var oRslt = dialog.store();
this.bChk1 = oRslt["Chk1"];
this.bChk2 = oRslt["Chk2"];


},

description:
{
name: "Energy Rating Information", // Dialog box title
elements:
[
{
type: "view",
elements:
[
{
name: "Enter Star Rating: ",
type: "static_text",
},
{
item_id: "txt1",
type: "edit_text",
multiline: true,
width: 300,
height: 20
},
{
name: "Enter MJ/m²: ",
type: "static_text",
},
{
item_id: "txt2",
type: "edit_text",
multiline: true,
width: 300,
height: 20
},

{
name: "Enter Accreditation Number: ",
type: "static_text",
},
{
item_id: "txt3",
type: "edit_text",
multiline: true,
width: 300,
height: 20
},

{
type: "view",
char_height: 10,
elements:
[
{
type: "static_text",
item_id: "stat",
name: "What type of rating is this?:",
char_width: 15,
alignment: "align_fill",
font: "dialog",
},
{
type: "view",
char_width: 8,
char_height: 8,
align_children: "align_top",
elements:
[
{
type: "view",
char_width: 8,
char_height: 8,
elements:
[
{
type: "check_box",
item_id: "Chk1",
name: "Single dwelling",
},
{
type: "check_box",
item_id: "Chk2",
name: "Multi-unit development",
},

]
},
]
},
]
},

{
type: "ok_cancel",
ok_name: "Ok",
cancel_name: "Cancel"
},
]
},
]
}
};


if(event.source.forReal && (event.source.stampName == "#fF_WBqLLUm0cA33ryprG3A"))
{
if ("ok" == app.execDialog(dialog))
{
var cMsg = dialog.starValue;
event.value = "\n" + cMsg;
event.source.source.info.mj = cMsg;

cMsg = "\n" + dialog.mjValue;
this.getField("MJ/m²").value = cMsg;

cMsg = "\n" + dialog.accValue;
this.getField("accreditation").value = cMsg;

}

}

I dont know how to post an image of the actual stamp or the actual pdf. Instructions on how to do this would be great too


Jorge Gutierrez 826 days ago


3 Answers

Voted Best Answer

avatar
<p>Congratulations! The Acrobat User Community selection team has approved your status as Expert in the Acrobat User Community. We appreciate all your past contributions and hope you will continue to support the community by answering questions and participating in the Acrobat Answers Q&A program as you've done in the past.</p>

<p>As an expert, you will get a badge to display on your profile with the level EXPERT next to your name and you have become eligible to be nominated to the Adobe Community Professional Program.</p>

<p>After reviewing the Adobe Community Professional Program information at https://www.adobe.com/communities/professionals/, please let us know if you are interested.</p>

<p>Someone from the selection team will contact you soon regarding the community professional program. Keep up the good work!</p>

<p>Regards,</p>

<p>The Acrobat User Community Team</p>


<p>**** Disclosure Requirements for Endorsements Received by Third Parties  ****</p>

<p>If you endorse or refer people to the Acrobat User Community in any venue,  it is our responsibility to ensure that you are aware of required compliance with the <a href="http://ftc.gov/os/2009/10/091005revisedendorsementguides.pdf">FTC’s Guidelines</a>. Both you and Adobe can be held liable under federal law for making unsubstantiated claims and for not disclosing your relationship with Adobe. In particular:</p>

<ol>
<li>Always disclose if you have received any type of incentive – free products, promotional items, travel, gifts, payment, and so on from Adobe. The disclosure must be on the same page as the endorsement.</li>
<li>Be truthful. Endorsements should not be misleading. Never make unsubstantiated or exaggerated claims about the benefits of Adobe products or programs. Any statements or endorsements about an Adobe product must be based on upon your actual experience.</li>
</ol>

Thank you again for your support of Adobe and the Acrobat User Community</p>

You can use the this.bChk1 variable and the checkThisBox() method of the check-box field to achieve that.

-------------------------------------
Visit my custom-made PDF scripts website: http://try67.blogspot.com
Contact me personally: try6767@gmail.com


By Gilad D (try67) answered 826 days ago  |   Comments (1)  |  New Comment

avatar
<p>Congratulations! The Acrobat User Community selection team has approved your status as Expert in the Acrobat User Community. We appreciate all your past contributions and hope you will continue to support the community by answering questions and participating in the Acrobat Answers Q&A program as you've done in the past.</p>

<p>As an expert, you will get a badge to display on your profile with the level EXPERT next to your name and you have become eligible to be nominated to the Adobe Community Professional Program.</p>

<p>After reviewing the Adobe Community Professional Program information at https://www.adobe.com/communities/professionals/, please let us know if you are interested.</p>

<p>Someone from the selection team will contact you soon regarding the community professional program. Keep up the good work!</p>

<p>Regards,</p>

<p>The Acrobat User Community Team</p>


<p>**** Disclosure Requirements for Endorsements Received by Third Parties  ****</p>

<p>If you endorse or refer people to the Acrobat User Community in any venue,  it is our responsibility to ensure that you are aware of required compliance with the <a href="http://ftc.gov/os/2009/10/091005revisedendorsementguides.pdf">FTC’s Guidelines</a>. Both you and Adobe can be held liable under federal law for making unsubstantiated claims and for not disclosing your relationship with Adobe. In particular:</p>

<ol>
<li>Always disclose if you have received any type of incentive – free products, promotional items, travel, gifts, payment, and so on from Adobe. The disclosure must be on the same page as the endorsement.</li>
<li>Be truthful. Endorsements should not be misleading. Never make unsubstantiated or exaggerated claims about the benefits of Adobe products or programs. Any statements or endorsements about an Adobe product must be based on upon your actual experience.</li>
</ol>

Thank you again for your support of Adobe and the Acrobat User Community</p>

Sorry, I meant dialog.bChk1 ...

Gilad D (try67) Commented 826 days ago  |   Report


avatar

  |   Report
Was this answer helpful?  
1
0

avatar
<p>Congratulations! The Acrobat User Community selection team has approved your status as Expert in the Acrobat User Community. We appreciate all your past contributions and hope you will continue to support the community by answering questions and participating in the Acrobat Answers Q&A program as you've done in the past.</p>

<p>As an expert, you will get a badge to display on your profile with the level EXPERT next to your name and you have become eligible to be nominated to the Adobe Community Professional Program.</p>

<p>After reviewing the Adobe Community Professional Program information at https://www.adobe.com/communities/professionals/, please let us know if you are interested.</p>

<p>Someone from the selection team will contact you soon regarding the community professional program. Keep up the good work!</p>

<p>Regards,</p>

<p>The Acrobat User Community Team</p>


<p>**** Disclosure Requirements for Endorsements Received by Third Parties  ****</p>

<p>If you endorse or refer people to the Acrobat User Community in any venue,  it is our responsibility to ensure that you are aware of required compliance with the <a href="http://ftc.gov/os/2009/10/091005revisedendorsementguides.pdf">FTC’s Guidelines</a>. Both you and Adobe can be held liable under federal law for making unsubstantiated claims and for not disclosing your relationship with Adobe. In particular:</p>

<ol>
<li>Always disclose if you have received any type of incentive – free products, promotional items, travel, gifts, payment, and so on from Adobe. The disclosure must be on the same page as the endorsement.</li>
<li>Be truthful. Endorsements should not be misleading. Never make unsubstantiated or exaggerated claims about the benefits of Adobe products or programs. Any statements or endorsements about an Adobe product must be based on upon your actual experience.</li>
</ol>

Thank you again for your support of Adobe and the Acrobat User Community</p>

You are doing pretty good so far. Although "dialog" is not a good name for your dialog box. It's a bit too generic and it's a keyword.

Add this code to your "ok" block

this.getField("YourCheckBox1").value = dialog.bChk1?"Yes":"Off";

or

this.getField("YourCheckBox1").checkThisBox(dialog.bChk1,0);

Either method works fine.

You might be interested in my new book
All About PDF Stamps in Acrobat and Paperless Workflows
It covers using checkboxes and custom dialogs on dynamic stamps.

Thom Parker
The source for PDF Scripting Info pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often

The most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Having trouble, Why Doesn't my Script Work


Thom Parker answered 826 days ago  |   Comments (0)  |  New Comment

avatar

  |   Report
Was this answer helpful?  
1
0

avatar
Welcome to the Acrobat Answers site. You're on your way! It won't take you many more points to reach the next level: Participant. And as you accumulate more points, you're also building your reputation with the community and with AcrobatUsers.com.

Thank you to the 2 people that took the time out to help me out. I believe both of you pointed me in the right direction.

But I have to thank Mr. Parker for the actual code example, looking around all over the net your name pops up everywhere in relation to JS and stamps and Im honored to have your help. For some reason it liked the first option better.

--> this.getField("YourCheckBox1").value = dialog.bChk1?"Yes":"Off";

Im definetely going to buy your book as I like the way you explain things and provide examples. I find fillable pdf forms, user inputs and paperless workflows absolutely fascinating. Maybe up the price of the book to $25 even so that its eligible for the FREE Super Saver Shipping.

Regards and have a great day


Jorge Gutierrez answered 826 days ago  |   Comments (1)  |  New Comment

avatar
<p>Congratulations! The Acrobat User Community selection team has approved your status as Expert in the Acrobat User Community. We appreciate all your past contributions and hope you will continue to support the community by answering questions and participating in the Acrobat Answers Q&A program as you've done in the past.</p>

<p>As an expert, you will get a badge to display on your profile with the level EXPERT next to your name and you have become eligible to be nominated to the Adobe Community Professional Program.</p>

<p>After reviewing the Adobe Community Professional Program information at https://www.adobe.com/communities/professionals/, please let us know if you are interested.</p>

<p>Someone from the selection team will contact you soon regarding the community professional program. Keep up the good work!</p>

<p>Regards,</p>

<p>The Acrobat User Community Team</p>


<p>**** Disclosure Requirements for Endorsements Received by Third Parties  ****</p>

<p>If you endorse or refer people to the Acrobat User Community in any venue,  it is our responsibility to ensure that you are aware of required compliance with the <a href="http://ftc.gov/os/2009/10/091005revisedendorsementguides.pdf">FTC’s Guidelines</a>. Both you and Adobe can be held liable under federal law for making unsubstantiated claims and for not disclosing your relationship with Adobe. In particular:</p>

<ol>
<li>Always disclose if you have received any type of incentive – free products, promotional items, travel, gifts, payment, and so on from Adobe. The disclosure must be on the same page as the endorsement.</li>
<li>Be truthful. Endorsements should not be misleading. Never make unsubstantiated or exaggerated claims about the benefits of Adobe products or programs. Any statements or endorsements about an Adobe product must be based on upon your actual experience.</li>
</ol>

Thank you again for your support of Adobe and the Acrobat User Community</p>

Gorge, Thanks for you comments and the purchase. I did not consider the super saver shipping when we set the price. I doubt there are many 5 cent items at Amazon;) So, I'll do that for the next edition.

Be sure to watch the preview at our book site. I'd be interested in hearing your comments.

Thom Parker Commented 826 days ago  |   Report


avatar

  |   Report
Was this answer helpful?  
0
0


Download
Acrobat XI trial

Get the trial now


Other Questions Needing Answers