Restrict request submission if mandatory field is not filled in.

nisha2606
Kilo Expert

Hello Everyone,

 

I have a scenario in my order guide that when form is not loaded completely user directly clicks on submit button without filling the mandatory field and REQ is created but with no details.

 

So, can anyone suggest me how can I give an alert to the user that if he clicks on submit button without filling the mandatory field the REQ shouldn't be submitted.

 

Regards,

Nisha

1 ACCEPTED SOLUTION

nisha2606
Kilo Expert

For this i used ng-if directive with submit button, which made submit button to become visible after the user selected option in mandatory field.

<button ng-if="!hasMandatory()" ng-disabled="submitted" name="submit" ng-click="triggerOnSubmit()" class="btn btn-primary">{{submitButtonMsg}}</button>
<span ng-if="submitting" style="padding-left:4px">${Submitting...}</span>

This solved my issue. 🙂

 

Thanks everyone for all your inputs.

 

Regards,

Nisha

View solution in original post

16 REPLIES 16

nisha2606
Kilo Expert

For this i used ng-if directive with submit button, which made submit button to become visible after the user selected option in mandatory field.

<button ng-if="!hasMandatory()" ng-disabled="submitted" name="submit" ng-click="triggerOnSubmit()" class="btn btn-primary">{{submitButtonMsg}}</button>
<span ng-if="submitting" style="padding-left:4px">${Submitting...}</span>

This solved my issue. 🙂

 

Thanks everyone for all your inputs.

 

Regards,

Nisha

Hi Nisha,

Can you tell some steps where did you add the above code and what is done exactly?

Regards

Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader