Support » Plugin: WP Datepicker » null [value] output when no date is filled out

  • Resolved booly66

    (@booly66)


    Hi,

    1/ How can the [my-wp-datepicker] tag output “null”, when no date has been filled out by the client ?

    2/ I can’t make the “default date” to “today”: it does not output today’s date.

    great plugin !

    thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Fahad Mahmood

    (@fahadmahmood)

    Kindly post your URL as well so we can see how is it behaving. Thank you.

    Thread Starter booly66

    (@booly66)

    thank you Fahad
    This is the url: mind-your-business.nu

    The only thing I need:
    when the user does not fill out a date, [my-date] should output null

    So the value null

    How can this be done please ?

    • This reply was modified 1 month ago by booly66.
    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    @booly66 actually this should be handled through a WordPress filter hook when you are submitting the form. Our plugin is turning your simple input type text field into a calendar field. After submission, we are not filtering the results. Technically it would be a different side of the implementation. At this moment we are playing with UI, as per your requirements, we have to code for server side.

    Alternatively, we can set a default value null on submit button click event. Would that be a good thing for other users as well? If yes, we can think about it in upcoming versions. If you will mention a default value for empty field so on submit empty field will set to null. How do you want to proceed? In both cases, it would be a new feature request.

    Thread Starter booly66

    (@booly66)

    a default value null on submit button event would be awesome ! Is this done by simple jQuery ?
    Now, when nothing is filled out, there is nothing output from [my-date] and this can break other systems connected to the form which freak out with an internal server error.

    I’d love to be your guinea pig for this, Fahad πŸ™‚

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    @booly66 correct, it can be achieved with simple jQuery. I have noted it as a feature request already. Thank you so much, in case you are in hurry so I can provide you a snippet of JS. Else please wait and soon you will get a new version with this option.

    Thread Starter booly66

    (@booly66)

    I would be very grateful for that codesnippet, that I can easily inject in the form page πŸ™‚

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    @booly66 are you good in code? If I can provide you pseudo code? Because to provide you a perfect one, I need to test and at this moment I am working on something really urgent.

    Thread Starter booly66

    (@booly66)

    Hi,

    I wrote and tested this code, and it works like a charm πŸ™‚

    jQuery(window).load(function ()  {
    
    $("form").submit(function(){
       var $input = $(this).find("input.dp-field");
       if (!$input.val()) {
         $input.val("null");
       }
    });
    
    	
    	
    });
    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    @booly66 awesome, that is what I was expecting from you. Great help my friend.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.