Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7912377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:35:05+00:00 2026-06-03T13:35:05+00:00

<?php echo CHtml::checkBox(‘markComplete’, FALSE , array( ‘class’ => ‘markComplete’, ‘id’=> ‘markComplete’.$events[‘id’], ‘ajax’ => array(

  • 0
    <?php echo CHtml::checkBox('markComplete', FALSE , 
                    array(
                    'class' => 'markComplete',
                    'id'=> 'markComplete'.$events['id'],                        
                    'ajax' => array(
                                    'url'=>$this->createUrl('/events/events/MarkComplete'),
                                    'data'=>'event_status_on='.$events['id'],
                                    'type'=>'POST',
                                    'beforeSend' => 'js:function(){   

                                        var idSelector = $("#markComplete'.$events['id'].'");   
                                        var check = idSelector.is(":checked");  
                                        var child = idSelector.parent("td");
                                        var parent = $(child).parent("TR");
                                        $(parent).css("opacity","0.5");


                                    }',
                                    'success'=>'js:function(resp) {                                                                         
                                        $("#right").prepend(resp);

                                        return true;                                        
                                    }'
                                    ),
                                )

                            );

    ?>

Chtml CheckBox click on checkbox but still marked as unchecked not changing.. if i change it to TRUE then it not change into FALSE… Submit it thrugh AJAX… Getting response perfectly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:35:06+00:00Added an answer on June 3, 2026 at 1:35 pm

    There is no error in your code, but the onclick handler that is finally generated for the checkBox returns false by default. Check your generated html, and you’ll see this:

    jQuery('body').undelegate('#markComplete_someId','click').delegate('#markComplete_someId','click',function(){jQuery.ajax({'url':'/something','data':'event_status_on=someId','type':'POST','beforeSend':function(){
         var idSelector = $("#markComplete");
         var check = idSelector.is(":checked");
         var child = idSelector.parent("td");
         var parent = $(child).parent("TR");
         $(parent).css("opacity","0.5");
    },
    'success':function(resp) {
          $("#right").prepend(resp);
          return true;
    },'cache':false});
     return false; // this line changes everything!!
    });
    

    That return false; in the end prevents the default onclick event behavior of any html element. This is mentioned in the documentation for the clientChange method. You’ll see that it allows us to specify certain special attributes for htmlOptions, such as 'ajax' that you have already used, and also 'return', that specifies what the onclick handler should return, which is false by default, we can change this to return true, by adding the 'return' property like this:

     <?php echo CHtml::checkBox('markComplete', FALSE , 
                    array(
                       'class' => 'markComplete',
                       'id'=> 'markComplete'.$events['id'],                        
                       'ajax' => array( /* add your code */ ),
                       'return' => true // add return like this
                    )
       );
    ?>
    

    That will make it work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have this line of code in the view. <?php echo CHtml::activeTextField($model,'start_time'); ?>
I have the dropdown list like this <?php echo $form->dropdownList($customers,'customer_name', CHtml::listData(Customers::model()->findAll(), 'id', 'customer_name'), array(
I put a Ajax link using the following code: echo chtml::ajaxLink('GO', 'http://localhost/index.php?r=user/delete', array('method'=>'POST')); But,
For example… This PHP code <?php echo '<html>'; echo '<body>'; echo '<h1>Header One</h1>'; echo
I use <?php echo __("this is my string"); ?> inside my views to display
Today I am trying to echo this php mysql statement within my javascript code,
Possible Duplicate: php echo vs open&close tag For example. Is this: <p>Hello welcome to
Creating a link in PHP: echo <a href=\$currentFile?rowID=$row['id']\>click here</a>; This throws an error: Parse
I have this simple php script <?php echo '<pre>'; // Outputs all the result
<?php echo isset($_GET[name])?$_GET['name']:'ddd'; ?> <?php ... $url = (http://localhost/web12/directory/list=.$_GET['name'].); //echo $url; ... ?> <form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.