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

Fill in Mandatory Fields to Print

Biffnet7
Registered: Dec 9 2009
Posts: 36
Answered

I know this subject has been discussed already but I cannot get this to work and I want to know what I am doing wrong. I am new to Livecycle.

I have a form that our print Department is adamant that will alert the user that some required fields are not filled in.

I have seen and inserted the Javascript under the button Click. Am I correct? What do I need to rename for it to find the fields I have on this form? I have tried inserting the name of the fields in my form into the Formfield1 sections. Am I wrong?

if (Form1.Page1.Formfield1.rawValue == null ||
Form1.Page1.Formfield2.rawValue == null ||
Form1.Page1.Formfield3.rawValue == null ||
...
Form1.Page1.Formfieldx.rawValue == null)
{
app.alert({cMsg:"Please fill out the mandatory fields.",cTitle: "More information requiered", nIcon: 1, nType: 0} );
}
else
{
xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);
}

Let me know what I am doing wrong.

On the plus side I have figured out the Page flow features in these forms which works excellent. Thanks for all the help you have been giving me since I went to Livecycle.

Thanks

Biff

Allen

jglitch
Registered: Jan 7 2008
Posts: 19
Hey Biff,

Your code seems to correct. My concern on this is does your form contain a subform? Maybe you could have missed that? If that is so, you may need to insert that subform name in your code.

j.glitch
Biffnet7
Registered: Dec 9 2009
Posts: 36
Thanks for the reply.

Let me post what I have inserted under click on a button. What am I doing wrong? It is a subform.

topmostSubform.Page1.Button4::click - (JavaScript, client)
if (topmostSubform.Page1.Project_Manager.rawValue == null ||
{
app.alert({cMsg:"Please fill out the mandatory fields.",cTitle: "More information requiered", nIcon: 1, nType: 0} );
}
else
{
xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);
}

Nothing happens.

Thanks

Biff


jglitch wrote:
Hey Biff,Your code seems to correct. My concern on this is does your form contain a subform? Maybe you could have missed that? If that is so, you may need to insert that subform name in your code.

j.glitch

Allen

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The "if" statement in your last post is unterminated. Is there more that you haven't posted? If not then this is a syntax error. Rewrite it like this:
if (topmostSubform.Page1.Project_Manager.rawValue == null )
All the parentheses and brackets have to match.

Here's an esiminar that discusses form struture as it relates to scripting.
https://admin.adobe.acrobat.com/_a200985228/p87746471/

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

Biffnet7
Registered: Dec 9 2009
Posts: 36
This worked!

Forgot the bracket.

Thanks

Biff

Allen

jglitch
Registered: Jan 7 2008
Posts: 19
as what thomp had said, BIFF, you need to terminate your "if" statement on the condition part.

also, YOU HAVE TO SET THE FIELD MANDATORY....

-Select your field.
-Under your Object tab, there are three more tabs (Field, Value, Binding).
-In the "Value" tab, under TYPE drop-down list, select "User Entered - Required".

That is why you think there is nothing going behind the scene.

hope that works.