type: datetime + readonly

type: datetime + readonly

SWATswatSWATswat Posts: 83Questions: 0Answers: 0
edited August 2018 in Editor

Hi team,

here is the code:

{
   label: "Heure arrivee",
   name: "heure_arrivee",
   def:   function () { return new Date(); },
   type: "datetime",
   format: "HH:mm:ss",
   attr: {
      "readonly": true
   }
                                                
},

the result is partial because I can not write in the texbox (result wanted)
but the time picker appears and with it the modification becomes possible (undesired result)

how to prevent the time picker from appearing on this textbox?

Thanks for your help

Version : Editor-PHP-1.7.2

Replies

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    attr: {
      "readonly": true,
      "autocomplete": false
    }
    

    Should do it. That is something that is going to be in the next release.

    Allan

  • SWATswatSWATswat Posts: 83Questions: 0Answers: 0

    Hi Allan,

    Thank you for your response, but it does not work

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Oops - it should be:

    attr: {
      "readonly": true,
      "autocomplete": "off"
    }
    

    Sorry!

    Allan

  • longer_celonger_ce Posts: 5Questions: 0Answers: 0
    edited August 2018

    Hi Allan,

    In my code it doesn`t work.
    Code below:

                           {
                                label: "Data",
                name: "data",
                def:   function () { return new Date(); },
                type: "datetime",
                format: "YYYY-MM-DD HH:mm:ss",
                attr: {
                    "readonly": true,
                    "autocomplete": "off"
              }
    
  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    If you inspect the input element, does it show the autocomplete attribute? Could you give me a link to the page in question?

    Thanks,
    Allan

  • longer_celonger_ce Posts: 5Questions: 0Answers: 0
    edited August 2018

    Hi Allan,

    Yes, it show the autocomplete attribute. But I would like this date is readonly

    You can check it on panel.ilare.pl

    longer_ce

  • SWATswatSWATswat Posts: 83Questions: 0Answers: 0
    edited August 2018

    Hi Allan,

    I'm confirm, does not work this code :

    {
       label: "Heure arrivee",
       name: "heure_arrivee",
       def:   function () { return new Date(); },
       type: "datetime",
       format: "HH:mm:ss",
          attr: {
          "readonly": true,
          "autocomplete": "off"
    }
                                                    
    },
    

    the attribute is existing :



    <input id="DTE_Field_heure_arrivee" readonly="readonly" autocomplete="off" type="text">
  • SWATswatSWATswat Posts: 83Questions: 0Answers: 0

    Hi Allan,

    An other idea ?

    Thank you.

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Hi,

    I've just had a look at your page and it does appear to add both the readonly and autocomplete attributes to the input element. When I click on it the cursor isn't shown (i.e. not keyboard editable) and the calendar does open. Because I can't type in it I can't make the auto complete appear on a future edit.

    What browser is it that you are using?

    Thanks,
    Allan

  • SWATswatSWATswat Posts: 83Questions: 0Answers: 0

    Hi Allan,

    For my part, with IE v11.0 and Fiferfox v61.0.2 the phenomenon is identical.

  • longer_celonger_ce Posts: 5Questions: 0Answers: 0

    Hi Allan,

    Have you solved this issue? It is very important for my datatable.

    Thanks a lot!

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Even in Firefox I'm still seeing the autocomplete attribute present and I'm unable to type into the input element.

    The one thing odd I do see in Firefox is that the text in the input element is white, so you can't actually see it unless it is selected. The style appears to come from forms.css line 89.

    Allan

  • SWATswatSWATswat Posts: 83Questions: 0Answers: 0

    Hello Allan,

    Actually keyboard input is not possible.
    On the other hand, as the timepicker remains to be displayed, the modification becomes possible by selecting with the mouse the desired time with the timepicker and because of this we can change the time.
    is it possible not to display the timepicker to avoid this modification by keeping the type time ?

    Thanking you.

  • brockta7brockta7 Posts: 4Questions: 2Answers: 0

    Any other suggestions on this? I too need a date time field that is read only, and do not want the calendar/time picker to come up if it's clicked.

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    To disable the field use field().disable() - that will stop keyboard input and also the picker from coming up.

    @SWATswat - Sorry, this dropped off my tab list so I missed the reply. Are you able to give me a link to your page so I can debug it please?

    Allan

  • SWATswatSWATswat Posts: 83Questions: 0Answers: 0

    Hi Allan,

    Link in the private message.

    Thank you.

  • sinfuljoshsinfuljosh Posts: 25Questions: 0Answers: 5

    because of the datetime type i think this is triggering the date popup.

    wouldnt you be able to create a listener tied to that input filed that triggers a prevent.default to keep the popup from opening on click?

This discussion has been closed.