CalcBuilder Forum

Inline Day Calculator

Usuario phil_adler 2016-02-08 16:54:38

I have made with your help a custom count # of days calendar. The results show up inline.

However whenever I choose the startdate the enddate is automatically choosing todays date even though it does not show up in the end date date picker. How can I prevent the end date from automatically assigning the todays date value before a end date is chosen. I have set the default to 0

Moonsoft support 2016-02-08 17:23:31

Hi,
if the field is empty, the date creation you use for calculate creates a 'today' date by default. What you need now is to set the result to 0 if any of the fields is not present, right?. Then you need an 'if/else' structure: Given startdate and enddate...

//if any of the date fields is empty
if($startdate==""||$enddate==""){

//set the result to 0
$days=0;
}
else{

//copy here your days calculation you had before
}



Hope this helps, regards

Usuario phil_adler 2016-02-08 18:48:31

ok Thanks. So i need to use that if statement for each of the 5 fields correct?

Usuario phil_adler 2016-02-08 18:57:50

Awesome thanks so much. The support for your product is OUTSTANDING!!!!!!

Moonsoft support 2016-02-08 19:07:30

Hi,
great, thank you, we appreciate the feedback.

Regards

...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!
...
CalcBuilder

Create dynamic calculators

Buy now!