Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

onsubmit cakephp icon change function

 <div class="bit-4 pad-small">
    <label>Cheque No</label>
    <?php echo $this->Form->input('cheque_no',array('label'=>false,'class'=>'custom-select','options' =>'' ,'empty' => '','required'));  ?> 
    <span>required</span>
  </div> 
   <div class="bit-4 pad-small">
    <label>DD No</label>
    <?php echo $this->Form->input('dd_no',array('label'=>false,'class'=>'custom-select','options' =>'' ,'empty' => '','required'));  ?> 
    <span>required</span>
  </div> 
 <div class="bit-4 pad-small"  style="float:none;">
        <br>
        <br>
     <?php echo $this->Form->input('approve', array(
                              'type'=>'checkbox', 
                               'style' => 'float:left;',
                               'label'=>'Approval of order',
                              'format' => array('before', 'input', 'between', 'label', 'after', 'error' ) 
       ) ); ?>
        <span>required</span>
       </div>
      <div class="bit-12" >
        <input type="submit"   value="Submit" class="form-submit button" />
      </div> 
    </div>

when i click on submit if i click approve a green tick has to be displayed else a red tick has to be displayed..What sholud i do?

like image 333
user Avatar asked May 11 '26 01:05

user


1 Answers

Put onChangeApprove function onchange event of "Approve button".

function onChangeApprove(thisObj) {
    if ($(thisObj).is(":checked")) {
        //change btn color to Green
         $("#imgControl").attr("src","/../img/green.png")  

    } else {
        //change btn color to Red
         $("#imgControl").attr("src","/../img/red.png")  
    }
}
like image 99
Parth Trivedi Avatar answered May 12 '26 16:05

Parth Trivedi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!