Highlighted

Dynamic Stamp - Double Entry on Input for Validation

New Here ,
Jun 10, 2020

Copy link to clipboard

Copied

Hi Adobe Community,

 

To offer context, I am creating a relatively simple, dynamic stamp that requires the user to input a filing number and a filing date via prompts. This portion I have been able to successfully run using the below script in a 3rd (hidden) field in the stamp:

if ((event.source.forReal)&&(event.source.stampName == "#MyTestStamp"))
{
this.getField("Number").value = app.response("Filing Number:");
this.getField("Date").value = app.response("Filing Date:");
}

My question is, is there a way prompt the user to enter the data twice and compare the values; if the data matches, it is printed on the stamp - if it does not match, an error is presented on the screen (or some other exit loop response)?

 

I have tried a few different versions including below, but none of them seem to work. Any suggestions are greatly appreciated.

if ((event.source.forReal)&&(event.source.stampName == "#MyTestStamp"))
{
this.getField("Number").value = app.response("Filing Number:");
this.getField("Number1").value = app.response("Confirm Filing Number:");
}
if (Number.value == Number1.value)
{event.value=Number.value}
Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Use this:

 

 

if (event.source && event.source.forReal && event.source.stampName == "#MyTestStamp") {
	var v1 = app.response("Filing Number:");
	var v2 = app.response("Confirm Filing Number:");
	if (v1!=v2) app.alert("Those numbers are not the same!");
	else {
		this.getField("Number").value = v1;
		this.getField("Number1").value = v2;
	}
}

 

 

Edit: code fixed  (x2)

 

Topics

How to

Views

138

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Dynamic Stamp - Double Entry on Input for Validation

New Here ,
Jun 10, 2020

Copy link to clipboard

Copied

Hi Adobe Community,

 

To offer context, I am creating a relatively simple, dynamic stamp that requires the user to input a filing number and a filing date via prompts. This portion I have been able to successfully run using the below script in a 3rd (hidden) field in the stamp:

if ((event.source.forReal)&&(event.source.stampName == "#MyTestStamp"))
{
this.getField("Number").value = app.response("Filing Number:");
this.getField("Date").value = app.response("Filing Date:");
}

My question is, is there a way prompt the user to enter the data twice and compare the values; if the data matches, it is printed on the stamp - if it does not match, an error is presented on the screen (or some other exit loop response)?

 

I have tried a few different versions including below, but none of them seem to work. Any suggestions are greatly appreciated.

if ((event.source.forReal)&&(event.source.stampName == "#MyTestStamp"))
{
this.getField("Number").value = app.response("Filing Number:");
this.getField("Number1").value = app.response("Confirm Filing Number:");
}
if (Number.value == Number1.value)
{event.value=Number.value}
Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Use this:

 

 

if (event.source && event.source.forReal && event.source.stampName == "#MyTestStamp") {
	var v1 = app.response("Filing Number:");
	var v2 = app.response("Confirm Filing Number:");
	if (v1!=v2) app.alert("Those numbers are not the same!");
	else {
		this.getField("Number").value = v1;
		this.getField("Number1").value = v2;
	}
}

 

 

Edit: code fixed  (x2)

 

Topics

How to

Views

139

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Jun 10, 2020

Copy link to clipboard

Copied

Use this:

 

 

if (event.source && event.source.forReal && event.source.stampName == "#MyTestStamp") {
	var v1 = app.response("Filing Number:");
	var v2 = app.response("Confirm Filing Number:");
	if (v1!=v2) app.alert("Those numbers are not the same!");
	else {
		this.getField("Number").value = v1;
		this.getField("Number1").value = v2;
	}
}

 

 

Edit: code fixed  (x2)

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Jun 11, 2020

Copy link to clipboard

Copied

Hi Try67,

First off, thanks so much for taking the time to look into this for me. I tried the code sample you provided, and for some reason the dialogue boxes never fired - so I wasn't able to confirm if the double entry portion worked. To help clarify exactly what fields I am using in the stamp, here is a screenshot of the stamp itself:

 

Capture.PNG

Currently the script that I am troubleshooting is contained in the Script field in the lower righthand corner, and the values entered in the prompts are populated in the fields above it.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
Jun 11, 2020

Copy link to clipboard

Copied

Sorry, it's fixed now.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
cpmcmxc LATEST
New Here ,
Jun 11, 2020

Copy link to clipboard

Copied

Your solution worked perfectly! Thanks so much Try67!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Resources
One Stop Solution for Acrobat
Edit a PDF