Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Required fields when not submitting form

Avatar

Former Community Member

Hi there,

I have a form that has several fields that management would like set to required. I have set them up that way but from what I've read so far, required fields are only "required" when there is a submit button on the form.

Is there any way to make required fields prevent the user from saving the form if they are blank? Some sort of validation script?

The business lines current process (which we currently can not change) is to fill out the form, print it out, then scan it into an imagining system , etc etc etc.

What we can to is skip the print step and save the PDF directly to the imaging system. I need to find out how to make those fields actually required without submitting the form. Is there any way to do this?

5 Replies

Avatar

Level 2

The PDF for Dynamic Forms states that you can set the validation at runtime.  The code used will be:

.mandatory =

I am reading on this in attempt to learn so I hope this helps.

Thanks,

Avatar

Level 3

Were you able to find a solution for this?

It's almost like I need a validation tool, to make sure that all questions are answered (that are required) before the print stage.  When you use the print button for this, it comes up with the error, but also presents the print dialogue box, that needs to be closed before each time.

Would love to hear if you figured out a way to do this.  Thanks

Avatar

Level 10

http://forums.adobe.com/message/6120782?tstart=0

Look this discussion, I have posted another way to make a form validation...

This validation can be used in any kind of event, so you can put it on preSave event

if any field return null value, you cancel the save event

Avatar

Level 3

Thank you RObert for your post, this has a lot of good stuff in the whole thread of the post. 

I'm not a programmer though, so some of it seems over my head.  I'm going to try and wade through it and see if I can figure anything out.

Gretchen

Avatar

Level 10

With the validation method I posted you can set easily your own validation with what is already made for you,

it doesn't need your fields to be required value, it just validate everything with some exceptions..

If you don't have any special validation to do in your form, you might be able to use the following :

if (form1.execValidate() == true){

 

}

otherwise, using any special validation is more convenient using the function in the link