D
D
des1roer2015-07-03 07:41:32
Yii
des1roer, 2015-07-03 07:41:32

Yii 1.* how to hide\block next input?

standard form

<div class="row">
        <?php if (empty($master)) echo $form->labelEx($model, 'speed'); ?>
        <?php if (empty($master)) echo $form->textField($model, 'speed', array('disabled' => $master)); ?>
        <?php if (empty($master)) echo $form->error($model, 'speed'); ?>
    </div>

    <div class="row">
        <?php if (empty($master)) echo $form->labelEx($model, 'power'); ?>
        <?php if (empty($master)) echo $form->textField($model, 'power', array('disabled' => $master)); ?>
        <?php if (empty($master)) echo $form->error($model, 'power'); ?>
    </div>

How can I make sure that the following data cannot be entered before the previous ones?
ajax is redundant. and about the script - some kind of dregs come out.
<div id = "check" class="row" display="none">
        <?php if (empty($master)) echo $form->labelEx($model, 'reclaimed'); ?>

        <?php
        if (empty($master))
            echo $form->checkBox($model, 'reclaimed', array(
                'template' => '{input} {labelTitle}',
                'class' => 'chclass',
               // 'visible' => 'FALSE',
                'onchange' => 'javascript:'
                . 'if(this.checked)'
                . ' document.getElementById("Engine_recovered").value= new Date().toLocaleDateString() +" "+ new Date().toLocaleTimeString();'
                . 'else document.getElementById("Engine_recovered").value="";'
                    )
            );
        ?>
        <?php if (empty($master)) echo $form->error($model, 'reclaimed'); ?>
    </div>

on display none zero reaction

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
des1roer, 2015-07-03
@des1roer

<?php if (empty($master)) echo $form->textArea($model, 'act_end', array('rows' => 6, 'cols' => 50)); 
        Yii::app()->getClientScript()->registerScript('myscript','$("#Engine_act_end").keyup(function() {
   document.getElementById(\'Engine_reclaimed\').style.display="block";
});');
        ?>

0---
<div class="row" >
        <?php if (empty($master)) echo $form->labelEx($model, 'reclaimed'); ?>

        <?php
        if (empty($master))
            echo $form->checkBox($model, 'reclaimed', array(
                'template' => '{input} {labelTitle}',
                'class' => 'chclass',
               // 'visible' => 'FALSE',
                'onchange' => 'javascript:'
                . 'if(this.checked)'
                . ' document.getElementById("Engine_recovered").value= new Date().toLocaleDateString() +" "+ new Date().toLocaleTimeString();'
                . 'else document.getElementById("Engine_recovered").value="";'
                    )
            );
        ?>
        <?php if (empty($master)) echo $form->error($model, 'reclaimed'); ?>
    </div>
 <script type='text/javascript'>
               document.getElementById('Engine_reclaimed').style.display = 'none';
            </script>

A
Andrew, 2015-07-03
@sorgo

ajax is better - load the fields as the previous ones are filled in,
well, or js - script - just remove disable as the fields are filled

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question