Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Mandatory checkbox in HTML in custom widget

Hafsa1
Mega Sage

HTML-----

<div class="col-md-12">
<div class="col">
<input type="checkbox" ng-model="c.formInput.emailCheck" name="email" id="email" ng-disabled="c.formInput.postCheck"> {{data.messages.email}}
</div>
</div>
<div class="col-md-12">
<div class="col"> <input type="checkbox" ng-model="c.formInput.postCheck" name="post" id="post" ng-disabled="c.formInput.emailCheck"> {{data.messages.post}}
</div>
</div>

---------------------------------

Output:-

Hafsa1_0-1760692418393.png

 

I have two checkbox in HTML, want to make it mandatory. Means atleast one of these checkbox must be selected. what to change in html

7 REPLIES 7

@Me Being Mustaq 

below is the custom "submit" button but applying your code is not working.

 

@Ankur Bawiskar  yes, there was requirement from customer that they want separate page for it and when user submit they just want a record for future reference for which we have created custom table to store records. And these records are very confidentials for which they have given access to very few high level people. And they need checkbox only and not radio button so that they can select 1 or both the checkbox. But atleast one should be selected by user.

 

---

<div class="buttonContainer pull-right">
<span ng-if="c.isLoading" class="text-muted"><i class="fa fa-spinner fa-pulse" aria-hidden="true"></i>
Please wait. your request is being submitted</span>

<button class="btn btn-primary" ng-click="c.getSummary()" ng-disabled="submitDisabled">
{{data.messages.submit}}
</button>
</div>
</form>
</div>
<!--makes the page unaccessible once item is submitted-->
<div class="bg-overlay" ng-if="c.itemSubmitted">
</div>

---

@Hafsa1 

share the complete widget code here HTML, Client controller etc

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

can you share emailid , i'll email you