Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Mandatory fields - restrict email, print and save.

Avatar

Level 1

It should be easy I'm sure but...

I've read a number of similar threads and all give different answers. I'm new to LiveCycle so please bear with me :-)

I have a form with a panel that needs important part numbers filling in. Unless they're completed I require the form to be blocked from saving, printing or emailing. I'm sure it should be easy.

I've applied "User Entered - Required" into the Value box of each field which puts a big red line around the boxes. No problem there.

At this point all the threads I've read now dig right into Javascript - and this is where I fall over. I have no idea where this goes or how to go about making it work?

Can anybody help me?

Much appreciated.

Craig

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

1. preSave cannot be aborted (see explaination at the end of the article).

2. for more than one validation at once write <validate>prePrint preSubmit</validate>

View solution in original post

6 Replies

Avatar

Level 1

Thanks Radzmar. Very helpful compared to most I've seen. Works a treat and it wasn't too difficult to go round the XML source code.

Just a couple of bits...

This blocks print and saving.

Is there away I can block the "Save As" function as I can see sneaky people sidestepping around it. Is there a <preSaveas> code for it?

Otherwise it's really cool - thanks.

PS Why when I go back in the source code does the script I've just added disappear even though I saved it?

Craig

Avatar

Level 1

I've also noticed that it doesn't like

<validate>prePrint</validate>

and
<validate>preExecute</validate>

together as it will do one or the other but not both.

Should there be any code between the 3 scripts?

Cheers,

Craig

Avatar

Correct answer by
Level 10

Hi,

1. preSave cannot be aborted (see explaination at the end of the article).

2. for more than one validation at once write <validate>prePrint preSubmit</validate>

Avatar

Level 1

Fantastic.

Many thanks for your help!

Craig

Avatar

Level 2

I you have already got the answer, please ignore this.

How ever, when you want certain mandatory fields need to fillout before excuting a task(SAVE,SUBMIT or EMAIL the pdf).

You can validate the feilds on the save or submitt functionalities.

Just check for F.page#.subform.feild_name == '' || F.page#.subform.feild_name == null{

                    Then take the pointer to feild by Highlighting or set focus to feild

                    Break the statement}

else{

make the form to save or submit

}

//

if

(!VF.validateField(F.P1.PartsSF.PART_ID, xfa, Utility.getFormID())) {

xfa.host.messageBox("Please enter PART #.");

FormUtils.focusField(F.P1.PartsSF.PART_ID);

}

else if ()

you need to have the java script file in the porgramfiles-- adobve-- reader--javascripts.

Let me know, if you have any question about this.