After countless modifications to a form, I am puzzled as to why two additional fields are not being sent this time.
Controller
vm.question = {};
Although most of the time these fields will be empty, I have never encountered an issue with sending blank field values before.
Existing field that is functioning properly
<div class="form-group">
<label class="col-md-2" for="english">Spanish</label>
<div class="col-md-10">
<input type="text" ng-model="vm.question.VerbiageSpanish"
id="verbiagespanish" name="verbiagespanish"
class="form-control"
placeholder="Spanish" />
</div>
</div>
Newly added fields to the form with ng-model
but failing to submit upon saving
<div class="form-group">
<label class="col-md-2" for="english">Parent ID</label>
<div class="col-md-10">
<input type="text" ng-model="vm.question.ParentId"
numbers-only style="width:30px" id="parentid"
name="parentid" class="form-control" />
</div>
</div>
<div class="form-group">
<label class="col-md-2" for="english">Parent Value</label>
<div class="col-md-10">
<input type="text" ng-model="vm.question.ParentValue"
style="width:220px" id="parentvalue" name="parentvalue"
class="form-control"
placeholder="Parent Value" />
</div>
</div>
Looking at the code example, it appears that VerbiageSpanish and other existing fields are present except for the new ParentId and ParentValue. How could this be happening?
{
"Active": true,
"Name": "test",
"Description": "test",
"Verbiage": "test",
"VerbiageSpanish": "test",
"directive": {
"1": true
},
"data": {
"1": "yes"
},
"SortOrder": {
"1": "2"
}
}
Update based on received feedback:
If I populate the ParentId and ParentValue fields, they do get sent over as I verified through console.log
Form submit button
<button type="button" class="btn btn-success" data-dismiss="modal" ng-click="vm.saveQuestion(vm.question)"> Save </button>
The controller sends all data to a service, so clearly there is no API communication when the fields are left empty
vm.saveQuestion = function (script) { var promise = ""; console.log('savequestion debug', script);
Upon entering data in those textboxes, here's what I observed
{
"Active": true,
"Name": "test",
"ParentId" : "22",
"ParentValue": "afafaf",
"Description": "test",
"Verbiage": "test",
"VerbiageSpanish": "test",
"directive": {
"1": true
},
"data": {
"1": "yes"
},
"SortOrder": {
"1": "2"
}
}