我有表格,我想提交整个数据一切都很好,除了单选按钮。单选按钮位于控制器范围内时会出现问题,但它们在控制器范围内工作正常。除了单选按钮,我正在获得所有其他字段的正确值,我不知道我在哪里犯错误我很困惑为什么它不起作用...
这是一个工作正常的角度脚本......
//handling form controller
app.controller('myForm',function($http,$scope){
$scope.formData={};
$scope.saveCashbook=function()
{
console.log(this.formData);
$http({
method: "POST",
url: 'cashbook/save_cash_entry',
data: $.param($scope.formData),
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function (data) {
if (data.status == 'success') {
alert('all okay');
} else {
alert(data)
}
});
}
});
这是我的html,其中双向数据绑定不工作,而单选按钮在范围内,当我将它们从控制器范围中放出时,双向数据绑定开始工作,但我不能得到我的单选按钮值在我的控制器中,我将它们保存到数据库。
<div class="col-sm-12" ng-controller="myForm">
<form name="supplier_form" id="myform" ng-submit="saveCashbook()" >
<div class="form-group col-sm-2" style="padding-top:30px;">
<label for="" class="label label-info">جمع</label>
<label class="control-label radio-inline">
<input type="radio" class="purple" value="jama" name="jamabanam" ng-model="formData.jamabanam" >
</label>
<label for="" class="label label-danger">بنام</label>
<label class="control-label radio-inline">
<input type="radio" class="purple" value="banam" name="jamabanam" ng-model="formData.jamabanam" >
</label>
</div>
<div class="form-group col-sm-2">
<label for="packing" class="control-label">رجسٹر</label>
<select id="register" name="register_id" ng-model="formData.register_id" class="form-control search-select two" >
<option value=""> </option>
<? $query=$this->dba->get_dropdown('register',array('id','name'));
foreach($query as $key=>$value):
?>
<option value="<?=$key?>"><?=$value; ?></option>
<? endforeach;?>
</select>
</div>
<div class="form-group col-sm-4">
<label for="raqam" class="control-label">نام</label>
<select id="name" name="name" ng-model="formData.name" class="form-control search-select two"></select>
</div>
<div class="form-group col-sm-2 has-error">
<label for="nuqsani-raqam" class="control-label">کھاتہ نمبر</label>
<input type="text" class="form-control" name="khata_id" ng-model="formData.khata_id" id="khata_no" >
</div>
<div class="form-group col-sm-2 has-success">
<label for="nuqsani-raqam" class="control-label">رقم</label>
<input type="text" name="raqam" class="form-control" ng-model="formData.raqam" id="raqqam">
</div>
<div class="form-group col-sm-12">
<label for="raqam" class="control-label">تفصیل</label>
<input type="text" name="details" ng-model="formData.details" id="details" class="form-control" >
</div>
<input type="submit" value="submit" name="submit" id="submit">
</form>
</div>
这是我的php函数,我在整理$_POST
public function save_cash_entry()
{
print_r($_POST);
exit();
}