Question: I think this is probably a simple one, but I am just trying to think of the most effective way of doing what I want.

What I have, is a page that allows a manager, to edit user's within their own department.
This works fine at its most basic, where by I run a query to return all users WHERE Department=*managers department*.

This will return all users within the same department. What I would like to do, is expand upon that, as some managers are responsible for several departments, and want to be able to edit users from various departments.

My thinking was to have a department table, with an entry for the user. There would then be a column for each department, and I would set the value to Yes for each department the manager is responsible for.

The tricky part would then be to adjust the query based on that information. What do you all think would be the best way to query the row, and for each field with a value of Yes, add on the department as an option in the query

I could do:

```
$row = mysql_fetch_assoc($result);
If($row['dept1'] == 'Yes') {
    $query. = " OR Department=dept1";
}
if($row['dept2'] == 'Yes') {
    $query. = " OR Department=dept2";
}

```

This would work I imagine, but would mean that I would need to manually go in and hard code a department if we were to add one or remove one etc.

Is there a more elegant solution?

Answer: 
If you want the submit button disabled if no choice is selected the easiest way is to check the length of the array in the ng-disabled attribute, without setting the required attribute

```
<input type="submit" value="Send" ng-click="submitSurvey(survey)" 
 ng-disabled="value.length==0" />

```

[See here for updated fiddle](http://jsfiddle.net/thbkA/2/)

Another way to do this would be to check the array length in the ng-required attribute of the checkboxes

```
<input type="checkbox" value="{{choice.id}}" ng-click="updateQuestionValue(choice)"
  ng-model="choice.checked" name="group-one" id="{{choice.id}}" 
  ng-required="value.length==0" />

```

[Second fiddle](http://jsfiddle.net/thbkA/4/)
Why not make your checkbox models the array

```
<input type="checkbox" ng-model="value[$index]" value="{{choice.id}}/>

```

Fiddle: <http://jsfiddle.net/thbkA/1/>