Jump to content

DateTimePicker for SweetAlert


bbm

Recommended Posts

20 minutes ago, bbm said:

is it possible to have a DateTimePicker as an InputType for a SweetAlert?

Hello,

One possible solution I think:

  UniSweetAlert1.Show;
  UniSession.AddJS('Ext.select(".swal2-input").elements[0].setAttribute("type", "date")');

 

Link to comment
Share on other sites

Hello Sherzod,

thank you so much, this looks nice and is exactly what i wanted. What I just don't know yet is how to enter a default value, e.g. the current date or any other value.
I tried UniSweetAlert1.InputValue, but I think you have to do this through JS?

Best regards,

Link to comment
Share on other sites

Hi Sherzod,

the format is no problem. I can parse the result and can switch to the needed format.

Important is to have an InputValue to be able to set the wanted date.

I hope you can find a solution :).

Best regards

 

 

Link to comment
Share on other sites

14 minutes ago, bbm said:

Important is to have an InputValue to be able to set the wanted date.

Try this approach:

  UniSweetAlert1.Show;
  UniSession.AddJS('let dt=Ext.select(".swal2-input").elements[0];'+
                   'if (dt) {'+
                   '    dt.setAttribute("type", "date");'+
                   '    dt.value="2021-09-01";'+
                   '}');

 

Link to comment
Share on other sites

Hi Sherzod,
thank you very much for the quick help. That works great. Is the date format always to be entered in JS (2021-09-01), or are there other formats as well?

I'm only asking because I need to convert the date format

Best regards

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...