Forums

Chronoforms with K2 and date/time picker

jari842 07 Oct, 2010
Hello,

I have a website, where within each article, there is a Chronoform contact form included. I need to have a function in each form, where the item title is captured automatically to a hidden field, and the information on the form + the item title emailed to me. I did this succesfully when I used Chronoforms only with Joomla articles, but when I switched to using K2, the code apparently doesn't work anymore. I tried to fix it according to by best knowhow (I'm not very experienced) by comparing the MySQL tables of k2_items and com_content, and fixing with that, without success. Please find the code I'm using at the moment (not used with Joomla/Chronoforms, only with Joomla/Chronoforms/K2).

<?php
if ( !$mainframe->isSite() ) { return; }
$title = JRequest::getString('title', '', 'get');
?>

<?php
    if ( !$mainframe->isSite() ) { return; }
    $article_id = JRequest::getInt('id');
    $title = '';
    if ( $article_id ) {
      $db =& JFactory::getDBO();
      $query = "
        SELECT `title`
          FROM `jos_k2_items`
          WHERE `id` = ".$db->quote($article_id)." ;
      ";
      $db->setQuery($query);
      $title = $db->loadResult();
    }
    ?>
    <input type='hidden' name='title' id='title' value='<?php echo $title; ?>' />


My other problem is that since I'm using also the "Tabs and Slices in content items" plugin from Joomlaworks, and I show the articles in blog format, Chronoforms puts all the date/time pickers of each category inside to the first form, meaning that for example if I have five articles in a category, Chronoforms shows the date/time picker five times in the first article, and it does not appear anymore on the other forms. Any ideas how to fix that?

Thank you!

Jari
GreyHead 08 Oct, 2010
Hi jari842,

Sorry, I know next to nothing about K2 or how it stores the info. The code you have looks OK to me assuming that there is an srticle id in the URL.

The tabs & slides issue is messier. Effectively you are embedding the same form several times in the same page. This means that none of the input names are unique and the calendar code can't tell which input to attach the datepicker too. I don't see any easy answer to that. It's a hazard of stacking up several plug-ins at a time.

Bob
This topic is locked and no more replies can be posted.