Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!

Creating Mandatory field in input form

Avatar

Level 2

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

8 Replies

Avatar

Community Advisor

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>

Avatar

Level 2

Hi Partha,

Already tried this but this is not working.

Thanks,

Ankita

Avatar

Level 7

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!

Avatar

Level 2

Hi,

I am trying will let you know once done.

Thanks
Ankita Vishe

Avatar

Community Advisor

@AnkitaV3131 , @Share us the script you used in input form for making the field mandatory, and the attribute structure in the schema.

Avatar

Level 3

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"
/>