复选框不能正常使用PHP

时间:2015-10-22 17:28:08

标签: php wordpress checkbox

我在WordPress的WP-Pro-Quiz插件中遇到了问题。 “单一答案选项”是可见的,但不可选择。我需要这些选项,我想我可以让复选框运行,然后在我的测验中得到我需要的结果。

是什么导致这些复选框“灰显”?

       <?php
}
private function singleChoiceOptions($data)
 {
    $single = $data[0];
    ?>
    <div class="postbox" id="singleChoiceOptions">
        <h3 class="hndle"><?php _e('Single choice options', 'wp-pro-quiz'); ?></h3>

        <div class="inside">
            <p class="description">
                <?php _e('If "Different points for each answer" is activated, you can activate a special mode.<br> This changes the calculation of the points',
                    'wp-pro-quiz'); ?>
            </p>
            <label>
                <input type="checkbox" name="answerPointsDiffModusActivated"
                       value="1" <?php $this->checked($this->question->isAnswerPointsDiffModusActivated()); ?>>
                <?php _e('Different points - modus 2 activate', 'wp-pro-quiz'); ?>
            </label>
            <br><br>

            <p class="description">
                <?php _e('Disables the distinction between correct and incorrect.', 'wp-pro-quiz'); ?><br>
            </p>
            <label>
                <input type="checkbox" name="disableCorrect" 
                       value="1" <?php $this->checked($this->question->isDisableCorrect()); ?>>
                <?php _e('Disable correct and incorrect.', 'wp-pro-quiz'); ?>
            </label>

            <div style="padding-top: 20px;">
                <a href="#" id="clickPointDia"><?php _e('Explanation of points calculation', 'wp-pro-quiz'); ?></a>
                <?php $this->answerPointDia(); ?>
            </div>
        </div>
    </div>

    <?php
}

2 个答案:

答案 0 :(得分:0)

灰色是因为被disabled="enabled"禁用,即使值为enabled,输入也会被禁用,任何值都会禁用输入,事实上,你可以放{{1}它将被禁用,最新的浏览器只读disable并禁用输入。删除disabled,输入将被启用。

答案 1 :(得分:0)

我想通了,名字值与$ this值,大写字母不匹配。插件作者必须错过它。希望这个功能有效。                            

        <div class="inside">
            <p class="description">
                <?php _e('If "Different points for each answer" is activated, you can activate a special mode.<br> This changes the calculation of the points',
                    'wp-pro-quiz'); ?>
            </p>
            <label>
                <input type="checkbox" name="AnswerPointsDiffModusActivated" value="1" <?php $this->checked($this->question->isAnswerPointsDiffModusActivated()); ?>> 
                <?php _e('Different points - modus 2 activate', 'wp-pro-quiz'); ?>
            </label>
            <br><br>

            <p class="description">
                <?php _e('Disables the distinction between correct and incorrect.', 'wp-pro-quiz'); ?><br>
            </p>
            <label>
                <input type="checkbox" name="DisableCorrect" 
                value="1" <?php $this->checked($this->question->isDisableCorrect()); ?>>
                <?php _e('Do not show correct and incorrect.', 'wp-pro-quiz'); ?>
            </label>

            <div style="padding-top: 20px;">
                <a href="#" id="clickPointDia"><?php _e('Explanation of points calculation', 'wp-pro-quiz'); ?></a>
                <?php $this->answerPointDia(); ?>
            </div>
        </div>
    </div>

    <?php