Set sn-record-picker mandatory

DPrasna
Tera Contributor

Hi All,

I have a custom widget inside which I use a sn-record-picker reference field on a custom form as shown below

HTML

<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label for="firstname"><b>User Name</b></label> 

<sn-record-picker id="firstname" field="c.addUsr.firstname"
table="'sys_user'"
default-query="data.existUserid"
display-field="'name'"
display-fields="'email'"
value-field="'sys_id'"
search-fields="'name,email'"
page-size="100"                 
>
</sn-record-picker>

</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label for="email"><b>Email</b></label>
<input type="text" placeholder="Enter Email" class="form-control" name="email" disabled required ng-model="c.addUsr.email1">
</div>
</div>

</div>

How to set the sn-record-picker field mandatory?

Please help.

TIA

@Ankur Bawiskar @BharathChintala @Allen Andreas @priyasunku @SatyakiBose 

1 ACCEPTED SOLUTION

@DPrasna 

 

can you please try this

 

<span style="padding-right: .25em" title="Mandatory" class="fa fa-asterisk mandatory" ng-class="{'mandatory-filled': data.user.value != ''}"></span>

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful

View solution in original post

5 REPLIES 5

priyasunku
Kilo Sage

Hi @DPrasna 

 

Could you please refer the below link and let me know if this helps you.

 

https://www.servicenow.com/community/itsm-forum/is-there-a-way-to-make-sn-record-picker-field-mandat...

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful

Hi Priya, Is there any simple way of doing it? like <span style ng-required something like that?

@DPrasna 

 

can you please try this

 

<span style="padding-right: .25em" title="Mandatory" class="fa fa-asterisk mandatory" ng-class="{'mandatory-filled': data.user.value != ''}"></span>

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful

Hi,

 

If you Don't mine can you give the full code snippet. Example of full code how to set mandatory.

 

Regards,

Manthira Moorthi R