beginner Mini Program, the checbox value of Baidu has not been reliable all afternoon. Come to the forum and ask the great gods
WeChat Mini Programs form form submission checkBox cannot get a value
<label class="checkbox">
<checkbox value="{{if_rem_user}}" checked="{{if_rem_user}}" name="rem_user" />
<text style="color:-sharpefffff;margin-top:20px;"></text>
</label>
the wxml code above is put in form. The submission method is as follows: why the output value does not contain the value of checkbox, and
how to get the selected status of checkbox
formSubmit: function (e) {
console.log(":" + JSON.stringify(e));
}
there are also the following direct values: why is rem_user undefined
var self;
var util = require("../../utils/md5.js");
var cn = require("../../utils/common.js");
Page({
data: {
username: "",
password: "",
if_rem_user:false
},
formSubmit: function (e) {
console.log(":" + JSON.stringify(e));
var user = e.detail.value.username;
var pwd = e.detail.value.password;
var rem_user = self.if_rem_user;
console.log("ck:" + rem_user);
},
onLoad: function (options) {
console.log("onload11");
self = this;
}
});