Hello all,
In my pervious version of CF (V3.2) my search form was working. Now I am trying to get it to work in CF V4.
I have aan CC for showing my data from the database. For searching the database I made a form in CF called 'search'. This form has the following content:
In the "Preview" tab I have a Custom Element with the HTML/PHP code for my form (including the submit button). This is the code:
In my "Events" tab I have in the "On Load" event the 'Show html'. In the "On submit" I first have the 'DB Multi Record Loader' with the following settings:
'Basic' tab:
- Table: movements_ewas
'Advanced' tab:
- Load Data: yes
- Data Load Type: ALL
- WHERE statement:
(this is the WHERE statement I use in CF V3.2).
After submiting the form I get an empty page, so no data is shown. How can I make this to work?
Regards,
Ruud
In my pervious version of CF (V3.2) my search form was working. Now I am trying to get it to work in CF V4.
I have aan CC for showing my data from the database. For searching the database I made a form in CF called 'search'. This form has the following content:
In the "Preview" tab I have a Custom Element with the HTML/PHP code for my form (including the submit button). This is the code:
<form name="ewas_zoeken" method="post">
<table align="center" style="text-align: left; width: 650px;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td style="font-weight: bold;"><label for="document">Registratie</label></td>
<td style="font-weight: bold;"><label for="author">Fotograaf</label></td>
<td style="font-weight: bold;"><label for="publication">Aircraft</label></td>
</tr>
<tr>
<td><input class="cf_inputbox" title="" type="text" id="text_1" name="reg"> </td>
<td><input class="cf_inputbox" title="" type="text" id="text_3" name="fotograaf"></td>
<td>
<?php
$db =& JFactory::getDBO();
$count = $db->loadResult();
$query = "
SELECT DISTINCT `aircraft`, `section`, `type`
FROM `movements_ewas` ORDER BY `section`, `aircraft`;
";
$db->setQuery($query);
$data = $db->loadObjectList();
?>
<select style='width: 210px;' class='cf_inputbox validate-selection' name='aircraft' id='select' size='1'>
<option value=''>Kies een toestel</option>
<?php
$optgroup = '';
foreach ( $data as $d ) {
$selected = '';
if ( $d->section != $optgroup ) {
if ( $optgroup ) {
echo "</optgroup>";
}
echo "<optgroup label='{$d->section}'>";
$optgroup = $d->section;
}
echo "<option value='{$d->aircraft}' $selected >{$d->aircraft} ({$d->type})</option>";
}
echo "</optgroup>";
?>
</select>
</td>
</tr>
<tr>
<td style="font-weight: bold;"><label for="owner2">Airline/User</label></td>
<td style="font-weight: bold;"><label for="type">Type</label></td>
<td style="font-weight: bold;"><label for="section">Categorie (Militair / Civiel)</label></td>
</tr>
<tr>
<td>
<?php
$db =& JFactory::getDBO();
$count = $db->loadResult();
$query = "
SELECT DISTINCT `owner2`
FROM `movements_ewas` ORDER BY `owner2`;
";
$db->setQuery($query);
$data = $db->loadObjectList();
?>
<select style='width: 210px;' class='cf_inputbox validate-selection' name='owner2' id='select' size='1'>
<option value=''>Kies een maatschappij/operator</option>
<?php
foreach ( $data as $d ) {
$selected = '';
if ( $d->id == $owner2 ) {
$selected = "selected='selected'";
}
echo "<option value='".$d->owner2."'>".$d->owner2."</option>";
}
?>
</select>
</td>
<td>
<?php
$db =& JFactory::getDBO();
$count = $db->loadResult();
$query = "
SELECT DISTINCT `type`
FROM `movements_ewas` ;
";
$db->setQuery($query);
$data = $db->loadObjectList();
?>
<select style='width: 210px;' class='cf_inputbox validate-selection' name='type' id='select' size='1'>
<option value=''>Kies een type</option>
<?php
foreach ( $data as $d ) {
$selected = '';
if ( $d->id == $type ) {
$selected = "selected='selected'";
}
echo "<option value='".$d->type."'>".$d->type."</option>";
}
?>
</select>
</td>
<td><div class="form_element cf_dropdown">
<select style='width: 210px;' class="cf_inputbox validate-selection" id="select" size="1" title="" name="section">
<option value="">Kies categorie</option>
<option value="">Beide</option>
<option value="Civil">Civiel</option>
<option value="Militair">Militair</option>
</select>
</div></td>
</tr>
</tbody>
</table>
<br />
<table align="center" width="600">
<tr>
<td colspan="3"><h3>Zoeken op jaar en/of maand</h3></td>
</tr>
<tr>
<td style="font-weight: bold;"><label for="year">Jaar</label></td>
<td style="font-weight: bold;"><label for="month">Maand</label></td>
<td style="font-weight: bold;"><label for="day">Dag</label></td>
</tr>
<tr>
<td>
<div class="form_element cf_dropdown">
<?php
$db =& JFactory::getDBO();
$count = $db->loadResult();
$query = "
SELECT DISTINCT `year`
FROM `movements_ewas` ;
";
$db->setQuery($query);
$data = $db->loadObjectList();
?>
<select style='width: 210px;' class='cf_inputbox validate-selection' name='year' id='select' size='1'>
<option value=''>Kies een jaartal</option>
<?php
foreach ( $data as $d ) {
$selected = '';
if ( $d->id == $year ) {
$selected = "selected='selected'";
}
echo "<option value='".$d->year."'>".$d->year."</option>";
}
?>
</select>
</div>
</td>
<td><div class="form_element cf_dropdown">
<?php
$db =& JFactory::getDBO();
$count = $db->loadResult();
$query = "
SELECT DISTINCT `month`
FROM `movements_ewas` ;
";
$db->setQuery($query);
$data = $db->loadObjectList();
?>
<select style='width: 210px;' class='cf_inputbox validate-selection' name='month' id='select' size='1'>
<option value=''>Kies een maand</option>
<?php
foreach ( $data as $d ) {
echo "<option value='".$d->month."' >".$d->month."</option>";
}
?>
</select>
</div>
</td>
<td>
<div class="form_element cf_dropdown">
<?php
$db =& JFactory::getDBO();
$count = $db->loadResult();
$query = "
SELECT DISTINCT `day`
FROM `movements_ewas` ;
";
$db->setQuery($query);
$data = $db->loadObjectList();
?>
<select style='width: 210px; overflow-y:scroll;' class='cf_inputbox validate-selection' name='day' id='select' size='1'>
<option value=''>Kies een dag</option>
<?php
foreach ( $data as $d ) {
echo "<option value='".$d->day."' >".$d->day."</option>";
}
?>
</select>
</div></td>
</tr>
</table>
<br>
<table align="center">
<tr>
<td colspan="2"><h3>Zoek voorwaarden</h3></td>
</tr>
<tr>
<td><INPUT TYPE="checkbox" NAME="ac_only">Aviation Cosmetics klant</td>
</tr>
<tr>
<td><INPUT TYPE="checkbox" NAME="images_only">Alleen de movements met foto</td>
</tr>
<tr>
<td><INPUT TYPE="checkbox" NAME="remarks_only">Alleen de movements met commentaar</td>
</tr>
</table>
</div>
<table width="960" align="center" border="0">
<tr>
<td>
<div id="ewas_zoeken_submit_button">
<input type='submit' value='Zoekopdracht uitvoeren' name='filter' id='ewas_zoeken_button' action="/>
</div>
</td>
</tr>
</table>
</form>
In my "Events" tab I have in the "On Load" event the 'Show html'. In the "On submit" I first have the 'DB Multi Record Loader' with the following settings:
'Basic' tab:
- Table: movements_ewas
'Advanced' tab:
- Load Data: yes
- Data Load Type: ALL
- WHERE statement:
<?php
$search_array = array('reg', 'aircraft', 'orig', 'fotograaf', 'year', 'month', 'day', 'owner2', 'type', 'section');
$where = array();
foreach ( $search_array as $search ) {
$value = JRequest::getVar($search, '' , 'post');
if ( $value ) {
$where[] = " $search LIKE '%$value%' ";
}
}
$images = JRequest::getString('images_only', '', 'post');
if ( $images ) {
$where[] = "`photo` != '' ";
}
$ac = JRequest::getString('ac_only', '', 'post');
if ( $ac ) {
$where[] = "`ac` != '' ";
}
$remarks = JRequest::getString('remarks_only', '', 'post');
if ( $remarks ) {
$where[] = "`remarks` != '' ";
}
$filter_catid =& JRequest::getInt('filter_catid', 0, 'post');
if ( $filter_catid ) {
echo " WHERE `id` LIKE '$filter_catid' ";
}
if ( !empty($where) ) {
echo " WHERE ".implode(' AND ', $where);
}?>
(this is the WHERE statement I use in CF V3.2).
After submiting the form I get an empty page, so no data is shown. How can I make this to work?
Regards,
Ruud