WeChat Mini Programs form form submission checkBox cannot get a value

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;
    }
    });

A picture is worth a thousand words

clipboard.png

first question

  • Don't omit checkbox-group, just like using swiper, because event binding correlation is all on this, and name should be put here

second question

  • to get the value in data, you need to use self.data.if_rem_user, which is different from vue

remind

  • when you are not familiar with it at first, try to use the official example directly, modify it a little, and then consider performance related after familiarity with it. Simplify the code
  • consider taking a look at my article. I'm writing a summary about Mini Program
  • you can take a look at Mini Program's documentation on code snippets, and paste code snippet links to Mini Program questions for your convenience
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea8771-1ed9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea8771-1ed9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?