Hi Bob 😢
Over the last few days i have been trying to implement a drop down filter, using your recommended solution as detailed in:
http://greyhead.net/how-to-docs/chronoconnectivity-dynamic-filters-2
I have amended the code as best i can to fit my simple form data, however i cannot get it to work as required, possibly due to the nature of your code - it lists all documents that exist in joomla (i only want to allow a drop down of 4 static values), and also as the query used in your example which 2 data fields.
Please please..please could you assist me with this. I have a simple form which uses a radio element for a user to choose an RSVP response amongst other data - guest name, comments etc.
All i want is for chronoconnectivity to display the data collected in the RSVP submission form, and a drop down filter to allow a user to filter the responses from the total option of 4 different responses presented in the radio element on the RSVP form.
Right now the code works for the search facility (i have set to allow search on guest names or number of guests), and the drop down is populated with the radio options, however it displays the data from all entires ever made - not just the 4 different types.
The filter is working in the sense that if you click a particular RSVP radio entry, and press filter, it highlights, within the drop down, all of the same RSVP entires, i.e if 4 records state 'I will be attending the ceremony only' it will highlight 4 entries in the drop down.
Maybe this example isnt appropriate for my needs.
I have also read: http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=12&t=19179 is this better for what i want? Please show me the exact code, or a working example, as i cannot get either example to work, and have been trying all solutions i have found, and have every how to doc you have made available.
Here is my code:
WHERE SQL:
HEADER
BODY:
FOOTER:
Using the example in post: http://www.chronoengine.com/forums.html?cont=posts&f=12&t=19179
My code -
WHERE SQL:
HEADER:
BODY:
FOOTER:
N/A
Many thanks Bob🙂
Over the last few days i have been trying to implement a drop down filter, using your recommended solution as detailed in:
http://greyhead.net/how-to-docs/chronoconnectivity-dynamic-filters-2
I have amended the code as best i can to fit my simple form data, however i cannot get it to work as required, possibly due to the nature of your code - it lists all documents that exist in joomla (i only want to allow a drop down of 4 static values), and also as the query used in your example which 2 data fields.
Please please..please could you assist me with this. I have a simple form which uses a radio element for a user to choose an RSVP response amongst other data - guest name, comments etc.
All i want is for chronoconnectivity to display the data collected in the RSVP submission form, and a drop down filter to allow a user to filter the responses from the total option of 4 different responses presented in the radio element on the RSVP form.
Right now the code works for the search facility (i have set to allow search on guest names or number of guests), and the drop down is populated with the radio options, however it displays the data from all entires ever made - not just the 4 different types.
The filter is working in the sense that if you click a particular RSVP radio entry, and press filter, it highlights, within the drop down, all of the same RSVP entires, i.e if 4 records state 'I will be attending the ceremony only' it will highlight 4 entries in the drop down.
Maybe this example isnt appropriate for my needs.
I have also read: http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=12&t=19179 is this better for what i want? Please show me the exact code, or a working example, as i cannot get either example to work, and have been trying all solutions i have found, and have every how to doc you have made available.
Here is my code:
WHERE SQL:
<?php
// create the empty array
$where = array();
// check the text filter
$filter_text = JRequest::getString('filter_text', '', 'post');
if ( $filter_text ) {
$where[] = "( `gname` LIKE '%$filter_text%'
OR `numguests` LIKE '%$filter_text%')";
}
// check the response filter
$filter_response =& JRequest::getVar('filter_response', array(), 'post', 'array');
if ( count($filter_response) ) {
$filter = implode(', ', $filter_response);
$where[] = " `radio0` IN ($filter) ";
}
if ( count($where) ) {
$where = implode(' AND ', $where);
echo " WHERE $where ";
}
?>
HEADER
<?php
$db =& JFactory::getDBO();
global $count;
$count = $db->loadResult();
$style = "";
$style .= "
table.cf_listing {
margin-bottom: 12px;
}
";
if ( $style) {
$doc =& JFactory::getDocument();
$doc->addStyleDeclaration($style);
}
$script = "";
$script .= "
$('clear').addEvent('click', function() {
$('filter_text').value = '';
$('filter_catid').selectedIndex = -1;
});
";
if ( $script ) {
$doc =& JFactory::getDocument();
$script = "window.addEvent('domready', function() { $script });";
$doc->addScriptDeclaration($script);
}
$filter_text = JRequest::getString('filter_text', '', 'post');
$query = "
SELECT `radio0`
FROM `#__chronoforms_RSVPv1`
;
";
$db->setQuery($query);
$data = $db->loadObjectList();
?>
<select name='filter_response[]' id='filter_response' multiple='multiple' size='5' > <?php
$filter_response =& JRequest::getVar('filter_response', array(), 'post', 'array'); foreach ( $data as $d ) {
$selected = '';
if ( in_array($d->radio0, $filter_response) ) {
$selected = "selected='selected'";
}
echo "<option value='".$d->radio0."' $selected >".$d->radio0."</option>";
}
?>
</select>
<br />
<input type='text' name='filter_text' id='filter_text' value='<?php echo $filter_text; ?>'
/>Â <input type='submit' name='filter' id='filter' value='Filter' />Â <input
type='button' name='clear' id='clear' value='Clear' /> <table class='cf_listing'>
<?php
if ( !$count ) {
echo "<div>Sorry, no results were found.</div>";
} else {
?> <thead>
<tr>
<th style='width:130px; margin-left:12px;'>Guest name</th>
<th style='width:450px; margin-left:12px;'>Response</th>
<th style='width:100px; margin-left:12px;'>Total guests</th>
<th style='width:250px; margin-left:12px;'>Date received</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan='4' style='height:4px; background:silver;'></td>
</tr>
</tfoot>
<?php
}
?>
<tbody>
BODY:
<tr><td>{gname}</td><td>{radio0}</td><td>{numguests}</td><td>{recordtime}</td></tr>
FOOTER:
</tbody>
</table>
<?php
// get the row count and show the pagination if needed
global $count;
if ( $count ) {
?>
{pagination}
<?php
}
?>
Using the example in post: http://www.chronoengine.com/forums.html?cont=posts&f=12&t=19179
My code -
WHERE SQL:
<?php
$pyear = JRequest::getVar('pyear', '', 'post');
if ( $pyear > 0 ) {
echo " WHERE `pyear` = '$radio0' ";
}
?>
HEADER:
{new_record}<br />
<table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<input type='submit' name='filter' id='filter' value='Filter' />
<tr>
<select name="pyear" id="pyear">
<option value="0" default>Select</option>
<option value="I/WE WILL be attending the Ceremony ONLY">I/WE WILL be attending the Ceremony ONLY</option>
<option value="I/WE WILL be attending the Reception ONLY">I/WE WILL be attending the Reception ONLY</option>
<option value="I/WE WILL be attending BOTH the ceremony and Reception">I/WE WILL be attending BOTH the ceremony and Reception</option>
<option value="I/WE WILL NOT be attending the Ceremony or Reception">I/WE WILL NOT be attending the Ceremony or Reception</option>
</select>
</tr>
<tr>
<td style="font-weight: bold; width: 20%;">Guest Name</td>
<td style="font-weight: bold; width: 48%;">Response</td>
<td style="font-weight: bold; width: 20%;">Total guests</td>
<td style="font-weight: bold; width: 15%;">Date received</td>
</tr>
</tbody>
</table>
<div class="clr" style="border-bottom: 3px solid #222; padding: 3px; margin-bottom: 10px;"></div>
BODY:
<table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr<?php if ($i % 2) echo ' style="background-color: #EBEBEB;"';?>>
<td style="width: 20%;">{gname}</td>
<td style="width: 50%;">{radio0}</td>
<td style="width: 10%;">{numguests}</td>
<td style="width: 10%;">{recordtime}</td>
<td style="width: 5%;">{edit_record}</td>
</tr>
</tbody>
</table>
<?php $i++ ?>
FOOTER:
N/A
Many thanks Bob🙂