Hi,
I have a form with different questons. Each question is made up of three radio buttons where one of them has ng-value=“true” and the others ng-value=“false”.
Upon submit I want to check how many true values was choosen and display a different message depending on the number of true values.
I have no idea how to do this so any help is appreciated. I will try to fix a fiddle or something also.
My controller:
app.controller("testController", function($scope, $state, $http){
$state.go('test.start');
// we will store all of our form data in this object
$scope.formData = {};
// function to process the form
$scope.processForm = function() {
$state.go('test.result');
};
});
And question example:
<h2>question iushadajshdjksahdjkhasjkdjsahdjsajhdjsadjksadhsjahdjk</h2>
<ul class="row alternative-form">
<li ng-class="{'active': todo.check}">
<label class="alternative-wrapper alternative-one" for="alt1">
<p>Pulvinar scelerisque non augue augue turpis velit rhoncus elementum elit integer placerat duis.</p>
<input type="radio" class="alt-radio" id="alt1" name="alt" value="alt1" ng-model="todo.check" ng-value="true" />
</label>
</li>
<li ng-class="{'active': todo.check2}">
<label class="alternative-wrapper alternative-two" for="alt2">
<p>Pulvinar scelerisque non augue augue turpis velit rhoncus elementum elit integer placerat duis.</p>
<input type="radio" class="alt-radio" id="alt2" name="alt" value="alt2" ng-model="todo.check2" ng-value="false" />
</label>
</label>
</li>
<li ng-class="{'active': todo.check3}">
<label class="alternative-wrapper alternative-three" for="alt2">
<p>Pulvinar scelerisque non augue augue turpis velit rhoncus elementum elit integer placerat duis.</p>
<input type="radio" class="alt-radio" id="alt2" name="alt" value="alt3" ng-model="todo.check3" ng-value="false" />
</label>
</label>
</li>
</ul>