I have a form that I created using Adobe Acrobat Pro 9. I did all the fields using the form tools in Acrobat not designer.
Currently in the submit button I am running a java script that checks to make sure all the required fields are filled in before allowing the form to be submitted. The output format is currently XML.
I have read in other forums that this is possible using PHP and formmail and things I don't have. I am hoping there is a script I could put in my submit button that will make this happen. This is the script that is currently sitting in the Mouse Up action of the Submit button. Notice at the bottom it is currently set to XML. My client seems to think if she can think it, then it should be able to be done. So I am praying for a miracle here. Thanks in advance. I am self taught on the javascript through trial and error and realize what I have below could probably done in a different way, but this way makes sense to me.
var a = this.getField("Name")
var b = this.getField("State or Province")
var c = this.getField("Country")
var d = this.getField("E-mail address")
var e = this.getField("Research interest")
var f = this.getField("Interviewee Name 1")
if ((a.value == a.defaultValue))
{
a.setFocus()
app.alert("I'm sorry this field is required. Please provide your name.");
exit
}
else
if ((b.value == b.defaultValue))
{
b.setFocus()
app.alert("I'm sorry this field is required. Please provide your State or Province.");
exit
}
else
if ((c.value == c.defaultValue))
{
c.setFocus()
app.alert("I'm sorry this field is required. Please provide your Country.");
exit
}
else
if ((d.value == d.defaultValue))
{
d.setFocus()
app.alert("We're sorry, but the email field is required. Please provide a valid e-mail address. Note that delivery of transcripts is available only online, and for access you must provide an e-mail address.");
exit
}
else
if ((e.value == e.defaultValue))
{
e.setFocus()
app.alert("I'm sorry this field is required. Please provide a brief description of your research interest in the transcrip(s) you are requesting.");
exit
}
else
if ((f.value == f.defaultValue))
{
f.setFocus()
app.alert("I'm sorry this field is required. Please provide the name of the interviewee.");
exit
}
else
this.submitForm({
cURL: "mailto:some_email [at] someplace [dot] com",
cSubmitAs: "XML"
});
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script