Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Required fields are not displaying message when left empty

Avatar

Level 7

Hello,

I have set fields as required in the Value tab, the Type field as User Entered - Required. I also entered a message in the Empty Message field. When the user fills out the form, they are allowed to submit the form without filling in the fields.

Any help is greatly appreciated.

Thanks,

MDawn

1 Accepted Solution

Avatar

Correct answer by
Level 10

Use preSubmit event to check the Mandatory/ Required Fields before Submit..

Check the below thread for ideas.

http://forums.adobe.com/thread/606762?tstart=0

Usually if you use the Required field and submit the form, it will display the warning message that the required fields are missing and continue to Submit the form. So it is better to use the programmatic approach to get control on the form submission.

When you check for the field values programmatically you need to set the Type property in the Value type as User Entered - Optional.

Thanks

Srini

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

Use preSubmit event to check the Mandatory/ Required Fields before Submit..

Check the below thread for ideas.

http://forums.adobe.com/thread/606762?tstart=0

Usually if you use the Required field and submit the form, it will display the warning message that the required fields are missing and continue to Submit the form. So it is better to use the programmatic approach to get control on the form submission.

When you check for the field values programmatically you need to set the Type property in the Value type as User Entered - Optional.

Thanks

Srini

Avatar

Level 7

Hi,

Thanks for your response. I'm not sure what you mean by this statement:

When you check for the field values programmatically you need to set the Type property in the Value type as User Entered - Optional.

Should I set fields to User Entered - Optional rather than to User Entered - Required?

Margaret Dawn

Supervisor - Documentation

W: 630-850-1065

Avatar

Level 7

Sorry to fire emails at you! Do I select the Submit button and then the preSubmit event?

Margaret Dawn

Supervisor - Documentation

W: 630-850-1065

Avatar

Level 10

When you check for the field values programmatically you need to set the Type property in the Value type as User Entered - Optional.

Should I set fields to User Entered - Optional rather than to User Entered - Required?

Srini: Yes. Because when you set the  type as User Entered - Required, the submit button will do the checks for the Required fields that have this setting enabled at the time of submit. (which you do not have control - means controlling the form to submit only after every business validation is fulfilled).

Since you already doing the mandatory check programmatically, this will become 2nd time checking for the mandatory fields.

Through script you will check whether the mandatory field has value or not. If it is empty then you will not allow the for to submit.

Do I select the Submit button and then the preSubmit event?

Srini: Correct. You need to change the button type to Submit and place your mandatory field check code in the preSubmit event.

Thanks

Srini