表单中的日期输入问题

时间:2019-01-23 05:54:03

标签: cakephp-3.0

我试图烘烤代码,然后将输入格式作为date放在表中。烘烤后,日期输入总是说“不是有效的输入”, 错误是:

  

mb_strlen()期望参数1为字符串,数组为[CORE \ src \ Validation \ Validation.php,第844行]

我试图将其更改为text字段。它有效,但在date输入中不起作用,如果我不将类型输入为date,则它仅给出简单的文本字段输入...

 <?php
 /**
 * @var \App\View\AppView $this
 * @var \App\Model\Entity\EvaluationCandidate $evaluationCandidate
 */
 ?>
<nav class="large-3 medium-4 columns" id="actions-sidebar">
 <ul class="side-nav">
    <li class="heading"><?= __('Actions') ?></li>
    <li><?= $this->Html->link(__('List Evaluation Candidates'), ['action' 
 => 'index']) ?></li>
    </ul>
</nav>
 <div class="evaluationCandidates form large-9 medium-8 columns content">
<?= $this->Form->create($evaluationCandidate) ?>
<fieldset>
    <legend><?= __('Add Evaluation Candidate') ?></legend>
    <?php
        echo $this->Form->control('canid');
        echo $this->Form->control('name');
        echo $this->Form->control('written_test_score');
        echo $this->Form->control('percentage');
        echo $this->Form->control('eligible_percentage');
        echo $this->Form->control('selected_status');
        echo $this->Form->control('interviewer_name');
        echo $this->Form->control('interview_mode');
        //echo $this->Form->control('interview_date');
        echo $this->Form->input('interview_date', array(
            'type' => 'date',
            'label' => 'interview_date',
            'dateFormat' => 'YMD',
            'minYear' => date('Y') - 70,
            'maxYear' => date('Y') + 18,
        ));
        echo $this->Form->control('communication');
        echo $this->Form->control('attitude');
        echo $this->Form->control('technical_skill');
        echo $this->Form->control('overall_feedback');
        echo $this->Form->control('status');
    ?>
    </fieldset>
   <?= $this->Form->button(__('Submit')) ?>
    <?= $this->Form->end() ?>
    </div>

0 个答案:

没有答案