Creating Mandatory field in input form | Community
Skip to main content
Level 2
May 15, 2024
Solved

Creating Mandatory field in input form

  • May 15, 2024
  • 2 replies
  • 2271 views

Hello Team,

 

I'm looking to enforce mandatory fields in the delivery form to ensure nobody leaves them empty. I've tried using the "required" attribute along with the "leave" tag as suggested in the documentation, but it doesn't seem to be working.

 

Could you please suggest an alternative approach or guide me on how to properly implement this?

 

 

Thanks,

Ankita Vishe

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ALangridge

I've just recently set up a web form which has required fields - I was able to achieve this using:

 

<input ##all your other normal values here## required="required" aria-required="true" data-nl-ismandatory="true" />

2 replies

ParthaSarathy
Community Advisor
Community Advisor
May 15, 2024

Hi @ankitav3131 ,

required="true" will make the field's label display in Red color font. But it will still allow empty value.

<leave> tag will make a field mandatory in input form by throwing an error pop-up when the field is empty.

Example,

<input label="Internal Name" required="true" xpath="@internalName"/> <leave> <check expr="@internalName !=''"> <error>Internal Name is Mandatory</error> </check> </leave>
~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups
Level 2
May 15, 2024

Hi Partha,

Already tried this but this is not working.

Thanks,

Ankita

Heku_
Level 5
May 15, 2024

Hello @ankitav3131, if your field can be null, maybe it's a null value and you aren't checking it. You should try this check in the leave element.

<check expr="@field != NULL and @field != ''">

 Hope this helps!

ALangridge
ALangridgeAccepted solution
Level 4
May 15, 2024

I've just recently set up a web form which has required fields - I was able to achieve this using:

 

<input ##all your other normal values here## required="required" aria-required="true" data-nl-ismandatory="true" />
Sukrity_Wadhwa
Community Manager
Community Manager
May 30, 2024

Hi @ankitav3131,

Was the given solution by @alangridge helpful to resolve your query or do you still need more help here? Do let us know.

Thanks!

Sukrity Wadhwa