close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

WA server validations: check if more than 15 days are passed from inserted date

Thread began 5/09/2017 11:07 am by tony | Last modified 5/12/2017 10:16 am by Ray Borduin | 188 views | 9 replies |

tony

WA server validations: check if more than 15 days are passed from inserted date

Hi all,
I have a form with a date field where the user picks up a date.
I need to check if more than 15 days are passed from this date.
But I cannot find the right syntax in the WA server valkidation behaviour.
This is the server variable:
((isset($_POST["data_scontrino_reg"]))?date('Y-m-d',strtotime(str_replace("/","-",$_POST["data_scontrino_reg"]))):"")

and this is the MAX Date I specified in the related dialog box (using the yyyy-mm-dd setting):
<?php echo (date($_POST["data_scontrino_reg"],strtotime('+15 day'))); ?>

But it doesn't seem to work.
What am I doing wrong?
TIA
tony

Sign in to reply to this post

Ray BorduinWebAssist

If you want to restrict the date to be less than 15 days in the future, then Max date would be something like:

<?php echo (date('m/d/Y',strtotime($_POST["data_scontrino_reg"],'+15 day'))); ?>

Sign in to reply to this post

tony

Hi Ray,
I tried your code but it doesn't work.
I changed it to:
<?php echo (date('Y-m-d',strtotime($_POST["data_scontrino_reg"],'+15 day'))); ?>
but it doesn't work too.
What else can I do?

Sign in to reply to this post

Michael

This post has been deleted.

Ray BorduinWebAssist

Sorry I didn't think that through properly. That would restrict the date to be less than 15 days from itself. To set the max date to be 15 days from today the max date should just be:

<?php echo(date('m/d/Y',strtotime('+15 day'))); ?>

Sign in to reply to this post

tony

Hi Ray,
I think I haven't posted my question the right way.
I need to validate the date inserted checking if it is more than 15 days old.
Example:
today is 10 may 2017.
If the user enters the date 10 april 2017: date invalid;
If the user enters the date 5 may 2017: date valid.

I tried this:
<?php echo (date('Y-m-d',strtotime($_POST["data_scontrino_reg"],'+15 day'))); ?>
but it doesn't work.

TIA
tony

Sign in to reply to this post

Ray BorduinWebAssist

In that case I think you want to set the Min Date to:
<?php echo (date('Y-m-d',strtotime($_POST["data_scontrino_reg"],'-15 day'))); ?>

Sign in to reply to this post

tony

Hy Ray,
thanks for your reply.
What is the difference between:
- SET MAX DATE: <?php echo (date('Y-m-d',strtotime($_POST["data_scontrino_reg"],'+15 day'))); ?>
and
- SET MIN DATE: <?php echo (date('Y-m-d',strtotime($_POST["data_scontrino_reg"],'-15 day'))); ?>

Thay seems doing the same thing.
But I can be (easily) wrong. ;)
TIA
tony

Sign in to reply to this post

Ray BorduinWebAssist

Maximum date would allow any date before that to be entered.

Minimum date won't allow any date before it has to be after.

Sign in to reply to this post

tony

SOLVED:
I was making a big mistake: I was checking a date field (data_scontrino_reg) against itself using:
<?php echo (date('Y-m-d',strtotime($_POST["data_scontrino_reg"],'-15 day'))); ?>
as MIN DATE.
So, it was always failing.
But I need to check it against the current date, so I used:
<?php echo (date('Y-m-d',strtotime('-15 day'))); ?>
and it works.
Sorry for making this confusion.

Tony

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...