How to add date picker to textbox on custom dialog TinyMCE


Ramesh Babu

I have a custom button and when i click it i get a custom dialog. Everything was fine until there, now I need a datetime picker next to the custom dialog for that textbox. I'm also not interested in using jqueryUI package just for datepicker can give me a better solution.

You can try this fiddle https://jsfiddle.net/1qngde28/


var dialogConfig =  {
  title: 'Date Picker Missing',
  body: {
    type: 'panel',
    items: [
      {
        type: 'input',
        name: 'title',
        label: 'Enter Title'
      },
      {
        type: 'input',
        name: 'DateTime',
        label: 'Datetime DD/MM/YYYY'
      }
    ]
  },
  buttons: [
    {
      type: 'cancel',
      name: 'closeButton',
      text: 'Cancel'
    },
    {
      type: 'submit',
      name: 'submitButton',
      text: 'Insert',
      primary: true
    }
  ],
  initialData: {
    title: '',
    DateTime: ''
  },
  onSubmit: function (api) {
    var data = api.getData();


    tinymce.activeEditor.execCommand('mceInsertContent', false, '<p>My ' + data.title +' at: <strong>' + data.DateTime + '</strong></p>');
    api.close();
  }
};

tinymce.init({
  selector: 'textarea.petMachine',
  toolbar: 'dialog-example-btn',
  setup: function (editor) {
    editor.ui.registry.addButton('dialog-example-btn', {
      text:'[Insert]',
      onAction: function () {
        editor.windowManager.open(dialogConfig)
      }
    })
  }
});

`````````````````````````

Date Picker on DateTime Text box.

Thanks in Advance.
Ramesh Babu

I can do this using the date range picker plugin at the following URL http://www.daterangepicker.com/

This is the following code

//at Items /component declartion for form
{
   type: 'htmlpanel',
   html: '<input type="text" id="datepickerstart" class=" datepicker tox-textfield" readonly="readonly"></p>',
}


//at function

function _onAction() {

/* dialogue code here ..... */


                //Calling date picker
                $('.datepicker').daterangepicker({
                    singleDatePicker: true,
                    showDropdowns: true,
                    timePicker: true,
                    startDate: moment().startOf('hour')

                }, function (start, end, label) {
                    //alert($("#datepickerstart").val());
                });             
            }


//at calling function of dialogue
editor.ui.registry.addMenuItem('xxxxxx', {
                text: 'xxxxxx',
                context: 'insert',
                onAction: _onAction
            });


// Include js and css of datepicker at where editor is been used which will automatically recognize the daterangepicker function.

Related


How to add date picker to textbox on custom dialog TinyMCE

Ramesh Babu I have a custom button and when i click it i get a custom dialog. Everything was fine until there, now I need a datetime picker next to the custom dialog for that textbox. I'm also not interested in using jqueryUI package just for datepicker can gi

Date picker in custom dialog in Android

Ashish Kudale I want to use a date picker in a custom dialog. Clicking on the button will open the calendar to select the user's date. I have Button in my customDilaog class and on that button I click "I want to open calendar view". If I click this button, my

Date picker in custom dialog in Android

Ashish Kudale I want to use a date picker in a custom dialog. Clicking on the button will open the calendar to select the user's date. I have Button in my customDilaog class and on that button I click "I want to open calendar view". If I click this button, my

Date picker in custom dialog in Android

Ashish Kudale I want to use a date picker in a custom dialog. Clicking on the button will open the calendar to select the user's date. I have Button in my customDilaog class and on that button I click "I want to open calendar view". If I click this button, my

How to Set Date Limits in the Date Picker Dialog

queen stacey I want to set the date limit so that the user can't select more dates, for example if today is 1st January, then the user should not be able to select more than 7 dates, I mean he can't select 9th January. I also hope he doesn't choose the month a

How to Set Date Limits in the Date Picker Dialog

queen stacey I want to set the date limit so that the user can't select more dates, for example if today is 1st January, then the user should not be able to select more than 7 dates, I mean he can't select 9th January. I also hope he doesn't choose the month a

How to Set Date Limits in the Date Picker Dialog

queen stacey I want to set the date limit so that the user can't select more dates, for example if today is 1st January, then the user should not be able to select more than 7 dates, I mean he can't select 9th January. I also hope he doesn't choose the month a

How to add custom text addition in bootstrap date picker

Tasar Kumava My datepicker is working, but I want to add birthday text to the input box . please help Here is my code: $(function() { $("#datepicker").datepicker({ autoclose: true, todayHighlight: true }).datepicker('update', new Date()); }); <div

How to add custom text addition in bootstrap date picker

Tasar Kumava My datepicker is working, but I want to add birthday text to the input box . please help Here is my code: $(function() { $("#datepicker").datepicker({ autoclose: true, todayHighlight: true }).datepicker('update', new Date()); }); <div

How to add custom block in tinyMce

Tariq Hussein I want to add a custom format block for TinyMCE, I was able to do it using the following code. style_formats: [ {title : 'Code', block : 'pre', classes : 'pre-code', exact: true},] https://codepen.io/anon/pen/vWRGEg However, by adding this code,

How to add custom block in tinyMce

Tariq Hussein I want to add a custom format block for TinyMCE, I was able to do it using the following code. style_formats: [ {title : 'Code', block : 'pre', classes : 'pre-code', exact: true},] https://codepen.io/anon/pen/vWRGEg However, by adding this code,

How to add custom bullets to tinyMCE?

Ennio I would like to add some extra options to the bullet dropdown in tinyMCE, is this possible? I would like to add ►Bullet type and different color options. (red, blue, etc...) username Yes. In the tinyMCE configuration you need to specify: style_formats: [

How to add custom bullets to tinyMCE?

Ennio I would like to add some extra options to the bullet dropdown in tinyMCE, is this possible? I would like to add ►Bullet type and different color options. (red, blue, etc...) username Yes. In the tinyMCE configuration you need to specify: style_formats: [

How to add custom bullets to tinyMCE?

Ennio I would like to add some extra options to the bullet dropdown in tinyMCE, is this possible? I would like to add ►Bullet type and different color options. (red, blue, etc...) username yes. In the tinyMCE configuration you need to specify: style_formats: [

How to disable textbox date_picker

Gerry <label class="col-sm-2 control-label">New First Cut off*</label> <div class="col-sm-3"> <input type="text" class="form-control date_picker" id="n_first_cut" name='n_first_cut'> </div> $('n_first_cut').prop('disabled', true); May I know how to disab

How to disable textbox date_picker

Gerry <label class="col-sm-2 control-label">New First Cut off*</label> <div class="col-sm-3"> <input type="text" class="form-control date_picker" id="n_first_cut" name='n_first_cut'> </div> $('n_first_cut').prop('disabled', true); May I know how to disab

How to put date and time picker in dialog in android

Rishabh Agrawal I'm a new android and struggling how to add both date pickerand time pickera single dialog box, please guide me how can I do this I created one dialog boxand use function setviewexaggerate but I get exception AlertDialog.Builder dia

How to put date and time picker in dialog in android

Rishabh Agrawal I'm a new android and struggling how to add both date pickerand time pickera single dialog box, please guide me how can I do this I created one dialog boxand use function setviewexaggerate but I get exception AlertDialog.Builder dia

How to add calendar, date picker?

Don Desrosiers I need to add a calendar date picker in Excel 2013. I found out that the MonthView and DT Picker are no longer in the ActiveX menu and the link that may contain the CAB file is not working. There are documentation, but they depend on controls th

How to add date picker in JSP

help memory In this JSP, how do I add the datepicker to: <div> <label for="surveyStartDate">Survey Start Date:</label> <input type="text" name="surveyStartDate" value=""> </div> <div> <label for="surveyEndDate">Survey End Date:</label> <input t

How to set max date and min date in date picker dialog

Elsteen P I want the calendar to show a specific month and I want to define the allowed date range in the calendar DateTime today = DateTime.Today; DatePickerDialog dateDialog = new DatePickerDialog(this, this.OnToDateSet, today.Year, today.Month - 1, today.Da

Date picker textbox access

Bartos I'm using the datepicker jQuery plugin created by Stefan Petre, available here: http://www.eyecon.ro/datepicker/#about This is the code I use to apply the datepicker to the textbox $('.tableMstCellECD').DatePicker({ format: 'd/m/Y',

Date picker textbox access

Bartos I'm using the datepicker jQuery plugin created by Stefan Petre, available here: http://www.eyecon.ro/datepicker/#about This is the code I use to apply the datepicker to the textbox $('.tableMstCellECD').DatePicker({ format: 'd/m/Y',

How to add preselected date in date picker

User 2896120 I am using the jQuery datepicker plugin from KelvinLuck . This date picker is a multi-select date picker. In the tutorial it shows how to add 1 selected date, but I want to add many selected dates like this: .dpSetSelected( '18/06/2011', '19

How to set date picker dialog in android to yesterday's date

1234567 I have a datepicker code that sets the current date to the datepicker dialog How can i set that date to be yesterday's date especially during month end it will keep yesterday's date and previous month for example if on 1st of February we check it shoul

How to set max date in date picker dialog in android?

Yugesh Use date picker in my app to set date. I want to set the datepicker's max date to today based on the system date. I don't know how to set the datepicker's max date to today's date. Does anyone know can help me with this. My datepicker encoding is: priva

How to set date picker dialog in android to yesterday's date

1234567 I have a datepicker code that sets the current date to the datepicker dialog How can i set that date to be yesterday's date especially during month end it will keep yesterday's date and previous month for example if on 1st of February we check it shoul