<div class="col-sm-8">
    <div class="row gray_ttc">
        <div role="tabpanel">
            <?php
            $question_type = $this->session->userdata('question_type');
            $this->session->unset_userdata('question_type');
            ?>
            <!-- Nav tabs -->
            <ul class="nav nav-tabs" role="tablist">

                <li role="presentation" class="active">
                    <a href="#desc" aria-controls="desc" role="tab" data-toggle="tab">Descriptive Question</a>

                </li>

            </ul>

            <!-- Tab panes -->
            <div class="tab-content">

                <div role="tabpanel" class="tab-pane  col-sm-12 active" id="desc">

                    <div class="form-group col-sm-12">
                        <form class="cmxform" id="formID4" action="<?php echo base_url() . $quiz_info->url . '/edit-multiple-choice-question/' . $question_info->question_id; ?>" method="post" name="descForm" enctype="multipart/form-data" >
                            <div class="col-sm-8 col-sm-offset-2">
                                <div >
                                    <br/>
                                    <br/>
                                    <br/>
                                    <input type="text" 
                                           data-errormessage-value-missing="Question  is required!" 
                                           class="form-control validate[required]"  
                                           id="question_details" 
                                           name="question_details" 
                                           value="<?php
                                           if (set_value('question_details')) {
                                               echo set_value('question_details');
                                           } else {
                                               echo $question_info->question_details;
                                           }
                                           ?>"  
                                           placeholder="Please Type Your question" >
                                    <input type="hidden" class="form-control" id="question_type" name="question_type" value="3"  >
                                    <?php echo form_error('question_details'); ?>
                                    <div class="form-group  required" ></div>
                                </div> 
                                <input type="hidden" name="quiz_id" id="quiz_id" value="<?php echo $quiz_info->url; ?>">
                                
                                <?php if ($quiz_info->quiz_random_static == '2') { ?>

                                    <br/>   
                                    <div class="form-group  required" ></div>
                                    <div id="quiz_required_information_mcq">
                                        <div class="col-sm-6 padding-zero">
                                            <input type="number" 
                                                   data-errormessage-value-missing="Mark is required!" 
                                                   class="form-control validate[required]"  
                                                   id="points_per_answer" name="points_per_answer" value="<?php echo $question_info->points_per_answer; ?>"   
                                                   onchange = "checkNegative(this.value, 'marks3', 'marks_err3');"  
                                                   placeholder="Type  question Marks" 
                                                   title="Type  question Marks">
                                        </div>

                                        <div class="col-sm-6 padding-zero">
                                            <input type="number" 
                                                   data-errormessage-value-missing="Time limit required!"
                                                   class="form-control validate[required]"  
                                                   id="time_limit" name="time_limit" value="<?php echo $question_info->time_limit; ?>"  
                                                   onchange = "checkNegative(this.value, 'time_limit3', 'time_err3');" 
                                                   placeholder="Type Time Limit (In minute)" 
                                                   title="Type Time Limit (In minute)">
                                        </div>
                                    </div>

                                <?php } ?>

                            </div>

                            <div class="col-sm-10 col-sm-offset-1">
                                <div class="">
                                    <div class="form-group col-sm-12">
                                        <label for="desc_answer"><h3>Answer of the Question:</h3></label>
                                        <input class="showCorrect mc_forminput" type="hidden" name="option[]" value="Descriptive" id="dsc">
                                        <?php
                                        $i = 0;
                                        foreach ($question_options as $v_option) {
                                            ?>
                                            <textarea name="desc_answer" 
                                                      data-errormessage-value-missing="Answer is required!" 
                                                      class="form-control validate[required]" rows="7" ><?php echo $v_option->question_option; ?></textarea>

                                        <?php } ?>

                                    </div>
                                    <br/>
                                </div>
                            </div>

                            <div class=" col-sm-12" >
                                <br/>
                                <br/>
                                <div class="col-sm-4"></div>
                                <div class="col-sm-4">
                                    <button class="btn btn-success">Update Question</button>
                                </div>
                                <div class="col-sm-4"></div>

                                <div class="col-sm-4">
                                    <a class="btn btn-success" href="javascript:void(0)" id="finish_button1"> Skip </a>
                                </div>

                                <script>
                                    $('#finish_button1').click(function () {
                                        window.location.href = '<?php echo base_url() . 'quiz/' . $quiz_info->url.'/question'; ?>';
                                    });
                                </script>
                            </div>
                        </form>
                    </div>
                </div>

            </div>

        </div>

    </div><!-- /.row gray_ttc -->

</div>


<script>     function checkQuizType(quizURL, questionID, objID) {
        //        alert(questionID);
        var xmlhttp = false;
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp = false;
            }
        }
        if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
            xmlhttp = new XMLHttpRequest();
        }

        if (quizURL) {
            serverPage = '<?php echo base_url(); ?>get-quiz-required-information-edit/' + quizURL + '/' + questionID;
            xmlhttp.open("GET", serverPage);
            //        alert(serverPage);
            xmlhttp.onreadystatechange = function ()
            {
                //            alert(xmlhttp.readyState);
                //            alert(xmlhttp.status);
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                {
                    //                                    alert(xmlhttp.responseText);
                    document.getElementById(objID).innerHTML = xmlhttp.responseText;

                }
            }
            xmlhttp.send(null);
        } else {
            document.getElementById(objID).innerHTML = '';
        }
    }

</script>


<script type="text/javascript">

    document.forms['descForm'].elements['quiz_id'].value = '<?php
                                        if (set_value('quiz_id')) {
                                            echo set_value('quiz_id');
                                        } else {
                                            echo $quiz_info->url;
                                        }
                                        ?>';
    document.forms['descForm'].elements['topic_id'].value = '<?php
                                        if (set_value('topic_id')) {
                                            echo set_value('topic_id');
                                        } else {
                                            echo $question_info->topic_id;
                                        }
                                        ?>';

</script>