I am using the following code to loop through a record-set and dynamically create a form with different form_element/cf_form fields. The form is able to build the dynamic cf_fields, email and submit data.
The problem I am having is with the the calendar. I only see the input field and not the calendar. So the dates are manually being entered.
Is it possible to have more than 1 datetimepicker instance?
As it stands, I am only able to display 1 cf_datetimepicker with input and calendar. Any ideas? -
The problem I am having is with the the calendar. I only see the input field and not the calendar. So the dates are manually being entered.
Is it possible to have more than 1 datetimepicker instance?
$i=1;
while (!empty($options['0'][$task]))
{
$cdate = "completedate_" . $i;
....
echo "<div class='form_item'><div align='center'><div class='form_element cf_datetimepicker'><input class='cf_datetime' title='' size='8' id='".$cdate."' name='".$cdate."' type='text' /></div><div class='cfclear'></div></div></div></td>";
$i++;
}
As it stands, I am only able to display 1 cf_datetimepicker with input and calendar. Any ideas? -
Hi someguy2k,
ChronoForms uses the list of datapicker names in the Form General tab to loop through and set up the calendars. With this approach that list can't be complete. I haven't tested it but I think this will do what is needed (you may then need to clear the name list to stop a duplication).
Bob
ChronoForms uses the list of datapicker names in the Form General tab to loop through and set up the calendars. With this approach that list can't be complete. I haven't tested it but I think this will do what is needed (you may then need to clear the name list to stop a duplication).
$i=1;
while (!empty($options['0'][$task]))
{
$cdate = "completedate_" . $i;
....
echo "<div class='form_item'><div align='center'><div class='form_element cf_datetimepicker'> <input class='cf_datetime' title='' size='8' id='$cdate' name='$cdate' type='text' /></div><div class='cfclear'></div></div></div></td>";
HTML_ChronoContact::initiateCalendar($cdate, $MyForm);
$i++;
}
Bob
Bob - Thank You for the quick reply
I get the following output when I add HTML_ChronoContact::initiateCalendar($cdate, $MyForm);
i'm using
echo "<div class='form_item'><div align='center'><div class='form_element cf_datetimepicker'> <input class='cf_datetime' title='' size='8' id='$cdate' name='$cdate' type='text' /></div><div class='cfclear'></div></div></div></td>";
HTML_ChronoContact::initiateCalendar($cdate, $MyForm);
I get the following output when I add HTML_ChronoContact::initiateCalendar($cdate, $MyForm);
i'm using
echo "<div class='form_item'><div align='center'><div class='form_element cf_datetimepicker'> <input class='cf_datetime' title='' size='8' id='$cdate' name='$cdate' type='text' /></div><div class='cfclear'></div></div></div></td>";
HTML_ChronoContact::initiateCalendar($cdate, $MyForm);
Hi someguy2k,
OK - looks as though I have to dig a bit further. Somewhere it needs to be wrapped in script tags.
Back in a while.
Bob
OK - looks as though I have to dig a bit further. Somewhere it needs to be wrapped in script tags.
Back in a while.
Bob
Hi someguy2k,
Trying again
This now includes the code from the initiateCalendar method and loads it as a script into the page header.
Bob
Trying again
$i=1;
$script = "";
$datefieldformat =& $MyForm->formparams('datefieldformat', 'd/m/Y');
$datefieldextras =& $MyForm->formparams('datefieldextras', "classes: ['dashboard']");
while (!empty($options['0'][$task]))
{
$cdate = "completedate_" . $i;
....
echo "<div class='form_item'><div align='center'><div class='form_element cf_datetimepicker'> <input class='cf_datetime' title='' size='8' id='$cdate' name='$cdate' type='text' /></div><div class='cfclear'></div></div></div></td>";
$script .= "myCal_$cdate = new Calendar({ $cdate: '$datefieldformat' }, { $datefieldextras });";
$i++;
}
if ( $script ) {
$doc =& JFactory::getDocument();
$script = "window.addEvent('domready', function() { $script });";
$doc->addScriptDeclaration($script);
}
This now includes the code from the initiateCalendar method and loads it as a script into the page header.
Bob
That fixed the output problem. I'm back to the datepicker field only showing the input box. The idea was to make it easier for the user, allowing them to pick a calendar-date rather than typing it.
Hi someguy2k,
Missed that bit. Do you have "Load Chronoforms CSS/JS Files?" set to 'Yes' in the Form general tab?
Bob
Missed that bit. Do you have "Load Chronoforms CSS/JS Files?" set to 'Yes' in the Form general tab?
Bob
Your solution worked, Load Chronoforms CSS/JS Files was turned. I couldn't see it at 1st because I had the form loading inside my Tabs Module, which I can work around.
I have two additional questions.
1. How do I buy you a bear
2. Does the chronoform cookbook discuss advanced topics like this.
Thank you for you help!
I have two additional questions.
1. How do I buy you a bear
2. Does the chronoform cookbook discuss advanced topics like this.
Thank you for you help!
Hi someguy2k,
You can buy me a beer through the link in my sig below. Thanks for the thought.
The books discussed some advanced features like this - though not this one. There isn't a great deal on handling dates. There are only 350 pages and not everything made it into the final version :-(
Bob
You can buy me a beer through the link in my sig below. Thanks for the thought.
The books discussed some advanced features like this - though not this one. There isn't a great deal on handling dates. There are only 350 pages and not everything made it into the final version :-(
Bob
Can this be done to load dynamic fileupload fields? I used $file:jpg|png|pdf|xls{9999-1} and that didn't work...
$file = "fileupload_" . $i;
....
echo "<td height='30'><div align='center'><div class='form_item'><div class='form_element cf_fileupload'>";$me = $options['0'][$file];
if (empty($me)) {
echo "<input class='cf_fileupload ' title='' size='10' id='$file' name='$file' type='file' />";
This topic is locked and no more replies can be posted.