Search Engine in URL issue

2 posts by 2 authors in: Forums > CMS Builder
Last Post: July 3, 2012   (RSS)

By benedict - July 3, 2012

Hi guys,

I have a search form in my website that works fine using the custom search form/search engine method mentioned on http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html

It is working fine except...

In CMSB, an activitity is related to a State and the to one of that state's related Regions. When a user selects a state, they need to select a region. This all works fine.

On the front end, I am trying to replicate this - i.e. a user selects a state and then, if they like, a region (non-mandatory).

I have created the JQuery method of the relevant region field appearing, dependent on the user's State selection. My problem is that I have had to name each of the 9 different region fields "region" so that the search engine will work (see below). Problem is that when I click submit, it picks up the region field 9 times and screws up the search results. Am I allowed to name the field something else?:

<li>
<select name="state" id="state">
<option value="">-- Select A State --</option>
<?php foreach ($activity_statessearchRecords as $record): ?>
<option value="<?php echo $record['num'] ?>"><?php echo $record['title'] ?></option>
<?php endforeach ?>
</select>
</li>


<fieldset id="1">
<li>
<select name="region">
<option value="">-- Select Region --</option>
<?php foreach ($activity_citiesintRecords as $record): ?>
<option value="<?php echo $record['num'] ?>"><?php echo $record['title'] ?></option>
<?php endforeach ?>
</select>
</li>
</fieldset>
<fieldset id="2">
<li>
<select name="region">
<option value="">-- Select Region --</option>
<?php foreach ($activity_citiesvicRecords as $record): ?>
<option value="<?php echo $record['num'] ?>"><?php echo $record['title'] ?></option>
<?php endforeach ?>
</select>
</li>
</fieldset>
<fieldset id="3">
<li>
<select name="region">
<option value="">-- Select Region --</option>
<?php foreach ($activity_citiesnswRecords as $record): ?>
<option value="<?php echo $record['num'] ?>"><?php echo $record['title'] ?></option>
<?php endforeach ?>
</select>
</li>
</fieldset>
<fieldset id="4">
<li>
<select name="region">
<option value="">-- Select Region --</option>
<?php foreach ($activity_citiesqldRecords as $record): ?>
<option value="<?php echo $record['num'] ?>"><?php echo $record['title'] ?></option>
<?php endforeach ?>
</select>
</li>
</fieldset>
<fieldset id="5">
<li>
<select name="region">
<option value="">-- Select Region --</option>
<?php foreach ($activity_citieswaRecords as $record): ?>
<option value="<?php echo $record['num'] ?>"><?php echo $record['title'] ?></option>
<?php endforeach ?>
</select>
</li>
</fieldset>
<fieldset id="6">
<li>
<select name="region">
<option value="">-- Select Region --</option>
<?php foreach ($activity_citiessaRecords as $record): ?>
<option value="<?php echo $record['num'] ?>"><?php echo $record['title'] ?></option>
<?php endforeach ?>
</select>
</li>
</fieldset>
<fieldset id="7">
<li>
<select name="region">
<option value="">-- Select Region --</option>
<?php foreach ($activity_citiestasRecords as $record): ?>
<option value="<?php echo $record['num'] ?>"><?php echo $record['title'] ?></option>
<?php endforeach ?>
</select>
</li>
</fieldset>
<fieldset id="8">
<li>
<select name="region">
<option value="">-- Select Region --</option>
<?php foreach ($activity_citiesntRecords as $record): ?>
<option value="<?php echo $record['num'] ?>"><?php echo $record['title'] ?></option>
<?php endforeach ?>
</select>
</li>
</fieldset>
<fieldset id="9">
<li>
<select name="region">
<option value="">-- Select Region --</option>
<?php foreach ($activity_citiesactRecords as $record): ?>
<option value="<?php echo $record['num'] ?>"><?php echo $record['title'] ?></option>
<?php endforeach ?>
</select>
</li>
</fieldset>

<script type="text/javascript">
jQuery('select[name=state]').change(function(){
var fieldsetName = $(this).val();
$('fieldset').hide().filter('#' + fieldsetName).show();
});

// We need to hide all fieldsets:
$('fieldset').hide();
</script>