mercredi 1 juin 2016

Get checkboxes to send value instead of boolean

I have checkboxes with values in HTML. The problem is that I want the values to store in the database and not a boolean. How do I do this?

HTML:

 <div class="form-group" >
    <label >Bachelor</label><br>

        <input type="checkbox" id="ComputerScienceB" ng-model="vm.course.bachelor.computer" value="Computer Science"> Computer Science
        <br>
            <input type="checkbox" id="SystemsEngineeringB" ng-model="vm.course.bachelor.systems" value="Systems Engineering"> Systems Engineering
        <br>
        <input type="checkbox" id="EnvironmentalEngineeringB" ng-model="vm.course.bachelor.environmental" value="Environmental Engineering"> Environmental Engineering
           <br>
            <input type="checkbox" id="MechanicalEngineeringB" ng-model="vm.course.bachelor.mechanical" value="Mechanical Engineering"> Mechanical Engineering
        <br>
            <input type="checkbox" id="BiotechnologyB" ng-model="vm.course.bachelor.bio" value="Biotechnology"> Biotechnology
    </div>
    <br>


    <div class="form-group">
        <button type="submit" class="btn btn-primary" ng-click="vm.saveCourse()">Add Course</button>
    </div>
</form>

The database inserts the hole vm.course. I am using the hole mean stack.




Aucun commentaire:

Enregistrer un commentaire