How do I bind a checkbox to a boolean in Play! framework

前端 未结 3 1510
轮回少年
轮回少年 2021-02-19 19:34

An app I\'m working on using the Play! Framework has an object called gift with a boolean property, called Taken. How do I show the state of this value as a checkbox on my view

3条回答
  •  一生所求
    2021-02-19 20:07

    If you are able to use javascript, you can use:

    $(document).ready(function() {
        $( ":checkbox" ).each(function() {
            var name = $(this).attr("name");
            if(typeof(name) != "undefined") {
                var checkboxString = "";
                checkboxString = ''
                $(this).after(checkboxString);
            }
        });
    });
    

提交回复
热议问题