close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Check value between two data

Thread begun 4/27/2011 4:49 am by federicosintucci | Last modified 4/29/2011 6:26 am by Jason Byrnes | 2961 views | 7 replies |

federicosintucci

Check value between two data

I have two datapicker that beautifully work, but how should I check if the number of day between the two datas are <= of 5 days?

Ex. The event starts on Apr. 21th, if it ends on/before Apr. 26th the form should validate, otherwise it shows an error message.

Thanks!

Sign in to reply to this post

Jason ByrnesWebAssist

use Server side validation for this.

select Date validation type.

for the server variable, click the lightning bolt and select the endDate form element.

for the start date, enter:

php:
<?php echo((isset($_POST["startDate"]))?$_POST["startDate"]:""?>



for the end date enter:

php:
<?php echo((isset($_POST["startDate"]))?date("m/d/Y"mktime(0,0,0,date("m",strtotime($_POST["startDate"])),date("d",strtotime($_POST["startDate"]))+5,date("Y",strtotime($_POST["startDate"])))):""); ?>




this code is assuming your start date form element is named "startDate", you will need to adjust the code if you use a different name.

Sign in to reply to this post

federicosintucci

it gives an error:

$WAFV_Errors .= WAValidateDT(((isset($_POST["eventoDATA"]))?$_POST["eventoDATA"]:"") . "",true,".*","","",false,".*","","",true,3);
$WAFV_Errors .= WAValidateDT(((isset($_POST["eventoFINE"]))?$_POST["eventoFINE"]:"") . "",true,".*","".((isset($_POST["eventoDATA"]))?$_POST["eventoDATA"]:"") ."","".((isset($_POST["eventoDATA"]))?date("m/d/Y",*mktime(0,0,0,date("m",strtotime($_POST["eventoDATA"])),date("d",strtotime($_POST["eventoDATA"]))+5,date("Y",strtotime($_POST["eventoDATA"])))):"");* ."",false,".*","","",true,5);

the error it's between
$WAFV_Errors .= WAValidateDT(((isset($_POST["eventoFINE"]))?$_POST["eventoFINE"]:"") . "",true,".*"
and
* ."",false,".*","","",true,5);

Sign in to reply to this post

Jason ByrnesWebAssist

send me a copy of your page in a zip archive so I can see the code in context and test it.

Sign in to reply to this post

federicosintucci

onence from

ok, thanks!
do you need the script folder too?

Sign in to reply to this post

Jason ByrnesWebAssist

change line 23:

php:
$WAFV_Errors .= WAValidateDT(((isset($_POST["eventoFINE"]))?$_POST["eventoFINE"]:"") . "",true,".*","".((isset($_POST["eventoDATA"]))?$_POST["eventoDATA"]:"")  ."","".((isset($_POST["eventoDATA"]))?date("m/d/Y",*mktime(0,0,0,date("m",strtotime($_POST["eventoDATA"])),date("d",strtotime($_POST["eventoDATA"]))+5,date("Y",strtotime($_POST["eventoDATA"])))):"");*  ."",false,".*","","",true,5);



to:

php:
$WAFV_Errors .= WAValidateDT(((isset($_POST["eventoFINE"]))?$_POST["eventoFINE"]:"") . "",true,".*","".((isset($_POST["eventoDATA"]))?$_POST["eventoDATA"]:"")  ."","".((isset($_POST["eventoDATA"]))?date("m/d/Y", mktime(0,0,0,date("m",strtotime($_POST["eventoDATA"])),date("d",strtotime($_POST["eventoDATA"]))+5,date("Y",strtotime($_POST["eventoDATA"])))):"")  ."",false,".*","","",true,5);
Sign in to reply to this post

federicosintucci

Great, now it works on insert page!
I've to fix the update one not to show the error message on load, but it's ok.

Thank you Jason!

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

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