close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Date Time Validation

Thread began 11/29/2012 5:23 am by Cologne | Last modified 11/29/2012 3:02 pm by Cologne | 638 views | 7 replies |

Cologne

Date Time Validation

Hello,

I need some help with the Date/Time validation.

I want to check the age, via, 3 select boxes.

I use this validation yyyy-mm-dd

I think the problem are the select boxes. Cause if I use a simple input field, it works well.

To fix I tried to create the month and day value with date "n & j" but I think this does not work with the yyyy-mm-dd

Cheers,
Denis

Attached Files
_webassist.zip
Sign in to reply to this post

Cologne

I think I got the error.

it must be.

$WAFV_Errors .= WAValidateDT(((isset($_POST["year"]))?$_POST["year"]:"").'-'.((isset($_POST["month"]))?$_POST["month"]:"").'-'.((isset($_POST["day"]))?$_POST["day"]:"") . "",true,"\b\d{4}-(1[0-2]|0[1-9])-([12]\d|3[0-1]|0[1-9])\b","","".(date("Y-m-d", mktime(0, 0, 0,  date("m"), date("d"), date("Y") - 18)))  ."",false,".*","","",true,8);



maybe someone can check this :-)))

Sign in to reply to this post

Jason ByrnesWebAssist

yes, the problem is the format of the Max date setting

in the original you have:
<?php echo (date("Y-m-d", mktime(0, 0, 0, date("d"), date("m"), date("Y") - 18))); ?>

the mkdate function takes the date pieces in this order:
hours, minutes, seconds, month, day, year

you are not passing them in the correct order

Sign in to reply to this post

Cologne

Hey Jason,

do you know why 12 is coming before 1?

<select name="month" id="month">
<option value="0" <?php if (!(strcmp(0, (ValidatedField("registerstep1_250","month"))))) {echo "selected=\"selected\"";} ?>>Monat</option>
<?php
for($m=1; $m<=12; $m++){ ?>
<option value="<?php echo date("m", mktime(0, 0, 0, $m, 0, 0)); ?>" <?php if (!(strcmp(date("m", mktime(0, 0, 0, $m, 0, 0)), (ValidatedField("registerstep1_250","month"))))) {echo "selected=\"selected\"";} ?>><?php echo date("m", mktime(0, 0, 0, $m, 0, 0)); ?></option>
<?php } ?></select>



looks like register_step_1.php

is there a way to fix the order?

Cheers
Denis

Sign in to reply to this post

Jason ByrnesWebAssist

that page does not load for me, please post a valid link where I can see the problem

Sign in to reply to this post

Cologne

:-)

register_step_1.php?register=false

sorry!

Sign in to reply to this post

Jason ByrnesWebAssist

in this code:
<?php echo date("m", mktime(0, 0, 0, $m, 0, 0)); ?>


you pass 0 for the day, this tells the make time function to use the last day of the previous month in other words, december 31. the day and the year should pass a valid value
<?php echo date("m", mktime(0, 0, 0, $m, 1, 2012)); ?>

Sign in to reply to this post

Cologne

I did it without 2012 and works.

Thanks so much!

Denis

Sign in to reply to this post

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...