Expand my Community achievements bar.

SOLVED

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

1 Accepted Solution

Avatar

Correct answer by
Level 4

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

View solution in original post

9 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

Correct answer by
Level 4

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

Avatar

Administrator

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