Jump to content

Recommended Posts

I'm using JQuery datepicker and it is succesully returning  but I'm also using tinyMCE in the same form when the calender appears tinyMCe is disappearing.

Here is my code

<script type="text/javascript">
    $(function() { // Shorthand for $(document).ready(function() {
          $('select').change(function() {
                $.post('option.php', {data: $(this).val()}, function(data) {
                      $('div').addClass('datepicker').html(data);
                     // $( "#datepicker" ).datepicker();
                     // $( "#datepicker" ).datepicker.formatDate({dateFormat: 'yy-mm-dd'});
                    //  $( "#taskTime").val() =
                     $('#datepicker').datepicker({
        dateFormat: 'yy-mm-dd',
        inline: true,
        //minDate: new Date(2010, 1 - 1, 1),
        //maxDate:new Date(2010, 12 - 1, 31),
        altField: '#datepicker_value',
        onSelect: function(){
            var day1 = $("#datepicker").datepicker('getDate').getDate();                
            var month1 = $("#datepicker").datepicker('getDate').getMonth() + 1;            
            var year1 = $("#datepicker").datepicker('getDate').getFullYear();
            var fullDate = year1 + "-" + month1 + "-" + day1;
            $('input[name=taskTime]').val(fullDate);
           
        }
    });
                });
           

          });
         /* $(function() {
        $( "#datepicker" ).datepicker();
    });*/
    });
   
    tinyMCE.init({
        // General options
        mode : "textareas",
        theme : "advanced",
        plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks",

        // Theme options
        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        //theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        //theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,

        // Example content CSS (should be your site CSS)
        //content_css : "css/content.css",

        // Drop lists for link/image/media/template dialogs
        template_external_list_url : "lists/template_list.js",
        external_link_list_url : "lists/link_list.js",
        external_image_list_url : "lists/image_list.js",
        media_external_list_url : "lists/media_list.js",

        // Style formats
        style_formats : [
            {title : 'Bold text', inline : 'b'},
            {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
            {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
            {title : 'Example 1', inline : 'span', classes : 'example1'},
            {title : 'Example 2', inline : 'span', classes : 'example2'},
            {title : 'Table styles'},
            {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
        ],

        // Replace values for the template plugin
        template_replace_values : {
            username : "Some User",
            staffid : "991234"
        }
    });
</script>
<!-- /TinyMCE -->

Here is my form

 

 <form method="post" id="frm" enctype="multipart/form-data" encoding="multipart/form-data">
   Subject:<input type='text' name='subject' /><br />
   Assigned To:<input type='text' name='assigned' /><br />
   Task:<select id="opt" name="taskOpt">
    <option value="0" selected>Select Task</option>
    <option value="1">Controlled</option>
    <option value="2">With Notification</option>
    <option value="3">Periodically</option>
    <option value="4">Simple</option>

    </select>
    <input type="hidden" name="taskTime" id="taskTime"/>
<!--
  <div>
  </div>--><br /><br />
       <!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded -->
       
            <textarea name="task" id="elm1" name="elm1" rows="15" cols="100" style="width: 100%">
               
            </textarea>
   
   
        <br />
        <input type="submit" name="save" value="Submit" />
        <input type="reset" name="reset" value="Reset" />
</form>

 

On selecting the first and second option calender input is showing datepicker. Here is the php code

    <?php
    $val=$_POST['data'];
    switch($val){
    case 0:
        echo "Please select a task";
        break;
    case 1:
        echo "complete till:<input name='timetask' id='datepicker' type='text' />";
        break;
    case 2:
        echo "complete till:<input name='timetask' id='datepicker' type='text' />";
        break;
       
    default:
        //echo $val;
        break;
        }

textare is disappearing and showing extra tags

Link to comment
https://forums.phpfreaks.com/topic/267428-tinymce-and-datepicker-problem/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.