CF 5 php Validate date code

moises 04 Jun, 2017
Hi, i am trying to validate a date. User can use only a date after the current day.

This event switcher must done the work, but not.

Please, some help

 
<?php

$f_date = $form->data['datepicker19'];

$todays_date = date("d-m-Y");

$today = strtotime($todays_date);
$from_date = strtotime($f_date);



if ($from_date > $today)  {

$form->errors ['from_date'] = "Date in the past.";
return "fail";
} else {
return "success";
}

?>
GreyHead 04 Jun, 2017
Hi Moises,

The structure of your code looks right so I guess that you need to debug the PHP to make sure that it is doing exactly what you need. I would add temporary lines to echo our $from_data and $today and make sure that they can be compared.

Bob
zingales 07 Jun, 2017
Why did you decide to switch from easy form editing and field validation, to this coders-tailored CF6?
I understand coders needed a more complex way of creating form. but it's a very different product from cf5.
I wish to go back to cf5.
Should I really use php code to validate a simple field?
could you add a demo of upload a form to import equivalent to the following CF5 form, please?
GreyHead 08 Jun, 2017
Hi zingales,

You can continue using CFv5 if you prefer.

I'm sorry I don't see what your question is here. If you want a CFv6 answer then I suggest that you start a new thread tagged CFV6 and give more information about what exactly you need to validate.

Bob
zingales 08 Jun, 2017
Will you keep developing both branchs? 5 and 6 ?
They are different products.
I used chronoforms 3, 4 and 5, and they were similar, yet improved everytime.
A few minutes of exploration and I was ready to use them.
But CF6... without any decent reference manual or more that basic demo forms it's to me like going into the dark.
If you intend to develop and improve just branch 6, then I need to buy another easy form management system.
GreyHead 08 Jun, 2017
Hi zingales,

That's a question for Max who is the owner and developer.

So far I do not have much experience with CFv6 :-(

Bob
Max_admin 09 Jun, 2017
Hi zingales,

v6 is the most powerful and the best Chronoforms, just like v5, it may take sometime to have manuals covering everything, but for now you can use the "Easy mode", check the demo forms, or check the tutorials in the FAQs section, I'm trying to have some videos made soon.

v6 is the only version to be developed, v5 is already mature and may get only fixes or important updates.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.