0

"

Choose one of the following Documents

<p ng-if="chooseAwardDocForm.transcript.$error.required
&& chooseAwardDocForm.bachelors.$error.required
&& chooseAwardDocForm.masters.$error.required">Select one of the documents below:</p>


<div class="form-group">
    <input
            id="transcript"
            type="checkbox"
            name="transcript"
            ng-model="transcript"
            required="transcript && !bachelors && !masters">
    <label for="transcript">Transcript</label>


</div>
<br/><br/>

<div class="form-group">
    <input
            id="bachelors"
            type="checkbox"
            name="bachelors"
            ng-model="bachelors"
            required="!transcript && bachelors && !masters">
    <label for="bachelors">Bachelors Degree Completed year: 1999</label>


</div>
<br/><br/>

<div class="form-group">
    <input
            id="masters"
            type="checkbox"
            name="masters"
            ng-model="masters"
            required="!transcript && !bachelors && masters">
    <label for="masters">Masters Degree Completed year: 2001</label>

</div>
<br/><br/>

<div class="form-group">

    <button type="submit"> Select Shipping Address</button>

</div>

"

I have to : 1. limit the user to select only 1 checkbox. 2. Be able to submit the form upon selection of alteast 1 checkbox. 3. Upon selection of more than 1 checkbox user should not be able to proceed to submit. Either make it disabled of alert with validation error.

sachin
  • 1
  • 1
  • Why not use radiobutton? – long.luc Sep 09 '15 at 08:21
  • Agree with others that radiobuttons would be best. To do it the way you want, you could put a $watch/$watchGroup on the values (batchelors & masters) and use the change event to disable the other control using ngDisable. See http://stackoverflow.com/questions/15112584/using-scope-watch-and-scope-apply and https://docs.angularjs.org/api/ng/directive/ngDisabled . I see you're a newbie, so if you need more help, please provide a plunk for someone to edit - http://plnkr.co/ . – JsAndDotNet Sep 09 '15 at 08:26

0 Answers0