How to make a widget bootstrap dropdown list required?

Robert_Cartwrig
Tera Expert

Hello,

 

I'm finding a thousand ways not to make a bootstrap dropdown list required in a widget on the service portal.  Hoping someone out there can set me straight.  Here's my script:

 

<div class="form-group">
  <label class="required control-label col-sm-2" for="us"></label>
  <div class="dropdown">
    <button class="btn-dropdown btn-primary btn-block dropdown-toggle"
            data-toggle="dropdown"
            aria-expanded="false"
            type="button" >{{c.data.US}} <span class="caret"></span></button>
    <ul class="dropdown-menu" role="menu">
      <li role="presentation" ng-click="c.data.US = 'Yes'"><a>Yes</a></li>
      <li role="presentation" ng-click="c.data.US = 'No'"><a>No</a></li>
     </ul>
  </div>
</div>

 

Thanks for any and all help in advance.  Happy to promote helpful, informative, or correct answers!

 

Thank you,

Robert

2 REPLIES 2

Justin77
Mega Guru

Hi Robert, what is the end result of this dropdown selection?  Is it used in a form (HTML form or service catalog form?)  Most mandatory checks are made on submission of a form.  If it is on submission of a form (HTML or service catalog), writing some client side script to check if for !c.data.US could work.  If there is no submission, I would validate the same on the next action you have the user make.

Hi Justin,

 

It's in an HTML form custom widget. I may switch to a different dropdown or build the validation into the submission.  Just expected there to be a toggle...

Regards,

Robert