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

script button for form

lkjc1
Registered: May 25 2011
Posts: 4
Answered

Hello,
 
first sorry for my english, i'm french...
 
I made a form pdf fill. He ends by a button "register". in the pdf 3 fields are compulsory: email, function, activite.
When the person stopped filling the form, she clicks the button to register and, if the 3 fields are filled, we have directly a popup to register.
 
If one or several fields are not filled, we have a popup: by ex: required email.
Click OK and the pop up closes.
 
What I do not manage to find, it is how to connect the 2 actions.
because, once popups required mail is closed, the popup to register opening before the required mail is filled.
 
I wish that we can register the pdf ONLY when the required areas are filled.
 
I put on my button: action, mouse down, launch a script:
 
if (getField("email").value == ""){ app.alert("email requis !");
} else { eformpdf_submitForm();
 
} if (getField("fonction").value == ""){ app.alert("intitulé de fonction requis !");
} else { eformpdf_submitForm();
} if (getField("secteur").value == ""){ app.alert("secteur activité requis !");
} else { eformpdf_submitForm();
}
 
Then = > 2nd line, execute a command) of menu: file to register under.
  
I think that it can be possible to replay the 2nd line only if the required areas are filled but i don't know how...
 
Thank you in advance to everyone who can help me.
Laurence
  

My Product Information:
Acrobat Standard 9.0, Macintosh
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Try this:

var submit = true;

if (getField("email").value == ""){
app.alert("email requis !");
submit = false;
}

if (getField("fonction").value == ""){
app.alert("intitulé de fonction requis !");
submit = false;
}

if (getField("secteur").value == ""){
app.alert("secteur activité requis !");
submit = false;
}

if (submit) eformpdf_submitForm();

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

lkjc1
Registered: May 25 2011
Posts: 4
thank you.

works for the beginning ( if email, fonction ad secteur not filled : popup .. requis!)

but at the end i don't need a submitForm but a fonction to register. Is there something existing like :

if (submit) eformpdf_registerForm(); ?????


thank you


try67
Expert
Registered: Oct 30 2008
Posts: 2398
I thought you had a function called eformpdf_submitForm() and that you wanted to call it at the end...
What do you mean by "register"?

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

lkjc1
Registered: May 25 2011
Posts: 4
sorry, it's not register but "save as"

try67
Expert
Registered: Oct 30 2008
Posts: 2398
You can't call this command from a button script without a folder-level script on the local machine that calls it for you.

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

lkjc1
Registered: May 25 2011
Posts: 4
Accepted Answer
thanks a lot, not so easy....