当我尝试使用推送方法添加特定条目时,我无法提交/发布我的数据。
我有以下代码
var args = arguments[0] || {};
var TF;
var TA;
var basicSwitch;
var caViewBoolean;
var bounded_field;
var caViewDistance;
var commentTA;
var pinTF;
var newTF = [];
var issueTABoolean;
var correctTABoolean;
var issueTADistance;
var correctTADistance;
var mFields = [];
var isRequire = [];
var bounded_lblTitle = [];
var postButton;
$.scrView.customName = "New Entry";
if (args.fromLog == "Yes") {
Alloy.Globals.logViews.push($.scrView);
Alloy.Globals.logScrollableView.views = Alloy.Globals.logViews;
Alloy.Globals.logScrollableView.scrollToView($.scrView);
} else {
Alloy.Globals.locationViews.push($.scrView);
Alloy.Globals.locationScrollableView.views = Alloy.Globals.locationViews;
Alloy.Globals.locationScrollableView.scrollToView($.scrView);
}
//Click event of New Entry button
function onbtnClick() {
if (OS_ANDROID) {
Alloy.Globals.buttonClickEffect(postButton);
}
var mFields = [];
//Create data which will be used to create new entry
if (TF) {
var tf_dict = {
"id": TF._id,
"value": TF.value
};
mFields.push(tf_dict);
}
if (TA) {
var ta_dict = {
"id": TA._id,
"value": TA.value
};
mFields.push(ta_dict);
}
var boolean_dict = [i];
for (var k = 0; k < yesnobasicswitch.length; k++) {
if (yesnobasicswitch[i]) {
if (yesnobasicswitch[i].value) {
boolean_dict[i] = {
"id": yesnobasicswitch[i]._id,
"value": yesnobasicswitch[i].value,
"ca": {
"problem": issuetextarea[i].value,
"solution": correctivetextarea[i].value
}
};
} else {
boolean_dict[i] = {
"id": yesnobasicswitch[i]._id,
"value": yesnobasicswitch[i].value
};
}
mFields.push(boolean_dict[i]);
}
}
}
我不确定如果代码足以让人们理解我想要做的事情。代码是由其他人编写的,它只是其中的一部分。