Having trouble with the date range picker

I have tried without success to get this error resolved. However, after several hours of ‘fixing’ it. The error is relentless!

Any ideas why it keeps returning “Please enter a valid date.” The date is returned by the date range picker, i.e., date, date_start, date_end.

date is a type=“text”
date_start and date_end are type=“date”

As you can see it is these two that throws the error.

Please see the error shown in the image below.

@revjrblack, how is your form set up? You should only need the date range field, not the date range field and the start and end date fields because the start and end date fields are part of the date range field.

This might help you out for inserting a new record, Using the Date Range Picker with Insert and Update Record

For updating an existing record, use the same link as above, but also use this link to generate the dynamic data from the database, Using Date Range Picker with Dynamic Values

I’ll give it a try. Nevertheless, I have another site that is built identically as this one and it works perfectly. It’s got me perplexed. Ha!

Are you using the Equal To validation to confirm the start and end dates are equal to the date ranger picker? Trying to understand your work flow for entering them in twice. :slight_smile:

To answer your question about the error, the only thing I can think of is that the $_POST variables are wrong somehow.

The end and start are from the dmx-bind:value from the date range picker.

dmx-bind:value=“inp_date.start”
dmx-bind:value=“inp_date.end”

I just commented on those inputs out and try to insert again, and the errors still persist. Ha!

Ok, let’s look at your server action. Do you have the start and end dates listed in the $_POST variables and in the insert statement? I know it might sound like a silly question, but I have found that most of my errors are from something very small that I overlooked.

Try this, click on the variables and remove the validation on them.

That did it!

The funny thing is that validation was put in automatically. I didn’t put that in manually. Weird.

Thanks for your time and help!

Glad it worked ! :slight_smile:

1 Like