0

Dear all,

I have a requirement that, when the user click on a radiobutton of a listed module, all its permissions should be toggled down. This section comprises in a div "msg_body". there are more than one module and so more than one msg_body divs. I used jQuery for this and is working fine in FF but not in IE6.
I am using the php framework for this project and giving the view page and the jQuery code along with.
Expecting help from all of u.

/////// The view page////////
<div id="rightSideContentDiv">

         <div class="listHead">
                <span class="listHead_left">

                        Modules

                </span>
            <span class="listHead_right">

                     <span class="right_subopt" id="permission"><strong>Permission Levels</strong>  </span>
             </span>
            </div>
             <ul id="modulelist">
               <?php foreach($module_result as $module){ ?>
               <li>
                <p id="module_permission_<?php echo $module->module_id;?>">
                 <span class="left_options"><strong>
                 <?php 
                echo $module->module_name;

         ?></strong>
                 <input type="hidden" name="<?php echo $module->module_name;?>" value="<?php echo $module->module_id;?>" id="<?php echo $module->module_id;?>" class="moduletype" />

                 </span>
                 <span >&nbsp;</span>

                 <span class="right_options">

                     <span class="right_subopt" id="none">
                     None
                        <?php 

                        if($edit_role_id){

                            if(isset($module->permission_ids)){

                                $module_permission = unserialize($module->permission_ids);// die();

                                if($module_permission=='None'){


                                    $checked1  = TRUE;
                                    $checked2  = FALSE;
                                    $checked3  = FALSE;


                                }elseif($module_permission=='All'){

                                    $checked1  = FALSE;
                                    $checked2  = TRUE;
                                    $checked3  = FALSE;

                                }else{

                                    $checked1  = FALSE;
                                    $checked2  = FALSE;
                                    $checked3  = TRUE;

                                }
                            }
                        }else{

                            $checked1  = TRUE;
                            $checked2  = FALSE;
                            $checked3  = FALSE;
                        }
                        //echo "ch1:".$checked1."ch2:".$checked2."ch3:".$checked3;

                        $data1 = array(
                            "name"        => "role_$module->module_name",
                            "class"       => "role_permission_$module->module_id",
                            "value"       => "0",
                            "id"          => "select_none_$module->module_id",
                            "rel"         => "module_permission_$module->module_id",
                            "checked"     => "$checked1",
                            "style"       => "margin:10px",
                        );

                        echo form_radio($data1);

                        ?>
                     </span> 

                     <span class="right_subopt" id="all">
                     All
                        <?php $data2 = array(
                            "name"        => "role_$module->module_name",
                            "class"       => "role_permission_$module->module_id",
                            "value"       => "1",
                            "id"          => "select_all_$module->module_id",
                            "rel"         => "module_permission_$module->module_id",
                            "checked"     => "$checked2",
                            "style"       => "margin:10px",
                        );

                        echo form_radio($data2);

                         ?>
                     </span>

                     <span class="right_subopt" id="custom">
                     Custom
                        <?php $data3 = array(
                            "name"        => "role_$module->module_name",
                            "class"       => "role_permission_$module->module_id",
                            "value"       => "2",
                            "checked"     => "$checked3",
                            'style'       => "margin:10px",
                        );

                        echo form_radio($data3);

                         ?>
                     </span>
                    <div class="msg_body">
                        <div class="permission_body_<?php echo $module->module_id;?>">
                        <?php foreach($permission_result as $permission){

                            if($edit_role_id){

                                if($module_permission=='None'){

                                    $checkPer = FALSE;

                                }elseif($module_permission=='All'){

                                    $checkPer = TRUE;

                                }else{

                                    for($i=0;$i<count($module_permission);$i++){

                                        if($module_permission["$i"]==$permission->permission_id){

                                            $checkPer = TRUE;
                                            break;
                                        }else{

                                            $checkPer = FALSE;

                                        }

                                    }                               

                                }

                            }else{

                                $checkPer   = FALSE;
                            }

                            //echo "ch".$checkPer."<br>";
                         ?>
                          <input type="hidden" name="<?php echo $permission->permission_name;?>" value="<?php echo $permission->permission_id;?>" id="<?php echo $permission->permission_id;?>" class="permissiontype_<?php echo $module->module_id;?>" />
                               <span class="permission_content">  
                                <?php 


                                $data = array(
                                    "name"        => "roles[permission][$permission->permission_id]",
                                    "class"       => "permission_$module->module_id"."_"."$permission->permission_id",
                                    "value"       => $permission->permission_id,
                                    "checked"     => "$checkPer",
                                    "style"       => "margin:10px",
                                );
                                 echo form_checkbox($data);
                                 echo $permission->permission_name?>
                                </span>

                            <?php //} 
                            } //End of Foreach $permission_result?>

                        </div>
                    </div>
                 </span>
                 </p>
                </li>

            <?php  }//End of Foreach $module_result ?>

             </ul> 
             <span class="submitSpan">
             <?php 
                $data = array(
                    'name'      => 'submit_role',
                    'class'     => 'submit_role',
                    'value'     => 'Submit'
                );
             echo form_submit($data);
             ?>
             </span>
           <?php  echo form_close(); ?>
        </div>
////// End of view page.///////


/// jQuery used//////

$(document).ready(function(){


    //hide the all of the element with class msg_body
    $(".msg_body").hide();
    //slides the element with class "msg_body" when paragraph with class "msg_head" is clicked 
    $("ul#modulelist li span#custom").click(function()
    {
        $(this).next("div.msg_body").slideToggle(700).siblings("div.msg_body").slideUp("slow");

    });
});

//// End of jQuery//////

Edited by Dani: Formatting fixed

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by jino
0

Can you include a static HTML of your code along with the JS so that I can run it in a browser and debug? Just 1 or two modules should be fine.

Just save your page or something.

0

I had got the solution for this problem through googling.

when i include the radiobutton inside a h4 tag and give class name as "trigger". After that called the slidetoggle jquery as,

$("h4.trigger").click(function(){ });

It is now working in IE also..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.