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

Javascript HELP!

ajlangham
Registered: Oct 31 2011
Posts: 4
Answered

Hey everyone,
 
First post for help here. I've got a PDF form in Acrobat, which i need a certain text box to be validated, i need the text box to simply check the client has writted in the word "Creo" before they can send the form.
 
HELP!
 
I'm sure it's really easy but being a designer, i have NO scripting skills.
 
Andy.

My Product Information:
Acrobat Pro 10.1, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
What's the name of the text box to validate? How do you want to submit the form?

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

ajlangham
Registered: Oct 31 2011
Posts: 4
The text box will be called validation. I will be sending the PDF form data to a php script. Hope this helps.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
Use this code as the MouseUp action of your submit button:

  1. if (this.getField("validation").value=="Creo") {
  2. this.submitForm({cURL: "http://www.server.com" }); // replace the place-holder URL with your own
  3. } else {
  4. app.alert("Error."); // you can display an error message to the user here
  5. }

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

ajlangham
Registered: Oct 31 2011
Posts: 4
Thank you for your help.
ajlangham
Registered: Oct 31 2011
Posts: 4
Try67,

Can you tell me will adding cSubmitAs: "HTML" allow me to send this as a POST to a php script? apparently the current script you wrote above me needs to submit as a POST says the back end script writer. See my attempt below.

Andy.


if (this.getField("Validation").value=="Creo33") {
this.submitForm({cURL: "http://www.server.com/capture.php", cSubmitAs: "HTML"}); // replace the place-holder URL with your own
} else {
app.alert("Error! Please check your Anti-Spam answer, this field is located under the logo."); // you can display an error message to the user here
}


try67
Expert
Registered: Oct 30 2008
Posts: 2398
Yes, if your PHP script is expecting an HTML page, sure.

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