Friday, February 27, 2015

Re: OnChange event wont work in cakephp

The onChange event is happening in the browser, so is not really related to CakePHP.

Please show the how code for the page, when it has been rendered in the browser. This may help us and you to understand what may have gone wrong with your code.

Enjoy, John

On Friday, 27 February 2015 16:06:54 UTC+2, ajt wrote:
Hi, I cant get any onchange event to fire. I just want to disable a textbox when some  options are selected.

I used id  and name in textbox but I cant get thus to work as when i click the radio button nothing changes.
I used radio buttons


echo $this->Form->input('startDate',array('id'=>'startdatebox','label' => 'Start Date','class'=>'datepicker', 'type'=>'text','style'=>'width:100px;height:30px','value' => $datestart));           echo '</td>';               echo '<td>';            echo $this->Form->input('endDate',array('id'=>'enddatebox','label' => 'End Date','class'=>'datepicker', 'type'=>'text','style'=>'width:100px;height:30px','value' => $dateend));               echo '</td>';                 echo $this -> Form -> input('dateRange',                  array('id'=>'dateRange','label' => '<h6>Date Range</h6>','type' => 'radio', 'value' =>$dateSelect,'options' =>  $selectoption));           <script type="text/javascript">    $(document).ready(function() {      $('#dateRange').change(function() {          if ( $(this:'checked').val() != 3 )          {              $('#startdatebox]').prop('disabled', true);              $('

No comments: