400 Error: Date Picker Doesn't Work in Modal

All my date pickers that are in modals throw a 400 error. It says it is not a valid date. However it is a perfectly valid date that displays.

I also tried displaying the form field value on the page and it seems it is trying to add a time to the date.

<div class="form-group">
<label for="input2">Event Date {{inputEventDate.value}}</label>
<input class="form-control form-control-sm" id="inputEventDate" name="inputEventDate" aria-describedby="input2_help" required="" type="text" is="dmx-date-picker" format="YYYY-MM-DD">
</div>

Actually it seems to be trying to add a time to it?

If it helps to know, this is on my very first Wappler site a couple years ago. Date Picker wasn’t available back then.

So it’s a two year old site if that matters.

Could you check in the Headers tab what the actual value is that was posted to insertEvent.php.

Not sure how to do that but I do know it is adding the time to the value.

So entering ‘2020-10-01’ is setting a value of ‘2020-10-01 00:00:00’

Brad, that is supposed to happen … the date picker returns the data in this format.

Then why am I getting an invalid format error?

What Patrick asks about is a screenshot of the Headers when the server action runs:

Screen Shot 2020-10-01 at 8.55.13 AM

That looks good, but your validation rule probably only expects a date, so without the time.

Alright, thanks. I will maybe replace the form fields and redo them from scratch. Only validation I have on it is ‘required’.

Thanks for confirming it is working as it should.

Please double check your POST variables in the server action. Maybe there’s a date rule imported there.

Yes, that was indeed the case. There was some date validation in the server connect post variables. Works great now. Thank you.

1 Like