0

I've been working on this for a couple days and know it's something small but for the life of me I can't figure it out. (I've been using Daniweb for a long time, but just joined because everyone seems so helpful. :) ) Maybe someone can help me too.

Here's my code:

{*
 * $Revision: 1.5 $
 * If you want to customize this file, do not edit it directly since future upgrades
 * may overwrite it.  Instead, copy it into a new directory called "local" and edit that
 * version.  Gallery will look for that file first and use it if it exists.
 *}
{g->callback type="search.getVariables"}

{g->addToTrailer}
<script type="text/javascript">
  // <![CDATA[
  search_SearchBlock_init('{g->text text="Search the Gallery"}', '{g->text text="Please enter a search term."}');
  // ]]>
</script>
{/g->addToTrailer}

<div class="{$class}">
  <form id="search_SearchBlock" action="{g->url}" method="post" onsubmit="return search_SearchBlock_checkForm()">
    <div>
      {g->hiddenFormVars}
      <input type="hidden" name="{g->formVar var="view"}" value="search.SearchScan"/>
      <input type="hidden" name="{g->formVar var="form[formName]"}" value="search_SearchBlock"/>
      <input type="text" id="searchCriteria" size="18"
	     name="{g->formVar var="form[searchCriteria]"}"
	     value="{g->text text="Search"}"
	     onfocus="search_SearchBlock_focus()"
	     onblur="search_SearchBlock_blur()"
	     class="textbox"/>
      <input type="hidden" name="{g->formVar var="form[useDefaultSettings]"}" value="1" />
      {if $theme.item.parentId}<input type="hidden" name="{g->formVar var="form[albumId]"}" value="{if $theme.item.canContainChildren}{$theme.item.id}{else}{$theme.item.parentId}{/if}" />{/if}
      {if $block.search.showSearchIcon}<input type="image" style="vertical-align: middle;" name="{g->formVar var="form[searchGallery]"}" alt="{g->text text="Search gallery"}" title="{g->text text="Search gallery"}" src="{if empty($theme.params.colorpack)}{g->url href="modules/search/images/search.gif"}{else}{g->url href='modules/colorpack/packs/'}{$theme.params.colorpack}/images/search.gif{/if}">{/if}
      {if $block.search.showSearchGalleryIcon}<input type="image" style="vertical-align: middle;" name="{g->formVar var="form[searchGallery]"}" alt="{g->text text="Search gallery"}" title="{g->text text="Search gallery"}" src="{if empty($theme.params.colorpack)}{g->url href="modules/search/images/searchGallery.gif"}{else}{g->url href='modules/colorpack/packs/'}{$theme.params.colorpack}/images/searchGallery.gif{/if}">{/if}
      {if $block.search.showSearchAlbumIcon && $theme.item.parentId}<input type="image" style="vertical-align: middle;" name="{g->formVar var="form[searchAlbum]"}" alt="{g->text text="Search album"}" title="{g->text text="Search album"}" src="{if empty($theme.params.colorpack)}{g->url href="modules/search/images/searchAlbum.gif"}{else}{g->url href='modules/colorpack/packs/'}{$theme.params.colorpack}/images/searchAlbum.gif{/if}">{/if}
    </div>
    {if $block.search.showCheckbox && $theme.item.parentId}
    <div>
      <input type="checkbox" style="vertical-align: middle;" name="{g->formVar var="form[searchAlbum]"}" {if $block.search.defaultCheckboxToOn}checked{/if}/>{if $block.search.checkboxText}{$block.search.checkboxText}{else}{g->text text="Search only in this album"}{/if}
    </div>
    {/if}
    {if $block.search.showAdvancedLink}
    <div>
      <a href="{g->url arg1="view=search.SearchScan" arg2="form[useDefaultSettings]=1"
		       arg3="return=1"}"
	 class="{g->linkId view="search.SearchScan"} advanced">{g->text text="Advanced Search"}</a>
    </div>
    {/if}

        Friends
<select name="g2_form[searchCriteria][]">

<option value="">&laquo; No Value &raquo;</option>
<option>Dave</option>
<option>Beth</option>
<option>Kyle</option></select>
<br />

        Work
<select name="g2_form[searchCriteria][]">

<option value="">&laquo; No Value &raquo;</option>
<option>Factory</option>
<option>Fast Food</option>
<option>Waiter</option>
<option>Pizza Hut</option></select>
<br />


<input type="submit" id="searchCriteria" class="inputTypeSubmit" name="Button1" value="Show"/>
  </form>
</div>

What I'm trying to do is to get the values of my dropdowns to submit to a search. So, if I select Beth from the first box and then Pizza Hut from the second it will return items using both of those words or combinations of words.

Hopefully, someone can point me in the right direction because this is driving me batty!

-Gecho

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by richieking
0

Well, after working with this for 10 hours I got a different problem...

{*
 * $Revision: 1.5 $
 * If you want to customize this file, do not edit it directly since future upgrades
 * may overwrite it.  Instead, copy it into a new directory called "local" and edit that
 * version.  Gallery will look for that file first and use it if it exists.
 *}
{g->callback type="search.getVariables"}

{g->addToTrailer}
<script type="text/javascript">
  // <![CDATA[
  search_SearchBlock_init('{g->text text="Search the Gallery"}', '{g->text text="Please enter a search term."}');
  // ]]>
</script>
{/g->addToTrailer}

<div class="{$class}">
  <form id="search_SearchBlock" action="{g->url}" method="post" onsubmit="return search_SearchBlock_checkForm()">
    <div>
      {g->hiddenFormVars}
      <input type="hidden" name="{g->formVar var="view"}" value="search.SearchScan"/>
      <input type="hidden" name="{g->formVar var="form[formName]"}" value="search_SearchBlock"/>
      <input type="text" id="searchCriteria" size="18"
	     name="{g->formVar var="form[searchCriteria]"}"
	     value="{g->text text="Search"}"
	     onfocus="search_SearchBlock_focus()"
	     onblur="search_SearchBlock_blur()"
	     class="textbox"/>
      <input type="hidden" name="{g->formVar var="form[useDefaultSettings]"}" value="1" />
      {if $theme.item.parentId}<input type="hidden" name="{g->formVar var="form[albumId]"}" value="{if $theme.item.canContainChildren}{$theme.item.id}{else}{$theme.item.parentId}{/if}" />{/if}
      {if $block.search.showSearchIcon}<input type="image" style="vertical-align: middle;" name="{g->formVar var="form[searchGallery]"}" alt="{g->text text="Search gallery"}" title="{g->text text="Search gallery"}" src="{if empty($theme.params.colorpack)}{g->url href="modules/search/images/search.gif"}{else}{g->url href='modules/colorpack/packs/'}{$theme.params.colorpack}/images/search.gif{/if}">{/if}
      {if $block.search.showSearchGalleryIcon}<input type="image" style="vertical-align: middle;" name="{g->formVar var="form[searchGallery]"}" alt="{g->text text="Search gallery"}" title="{g->text text="Search gallery"}" src="{if empty($theme.params.colorpack)}{g->url href="modules/search/images/searchGallery.gif"}{else}{g->url href='modules/colorpack/packs/'}{$theme.params.colorpack}/images/searchGallery.gif{/if}">{/if}
      {if $block.search.showSearchAlbumIcon && $theme.item.parentId}<input type="image" style="vertical-align: middle;" name="{g->formVar var="form[searchAlbum]"}" alt="{g->text text="Search album"}" title="{g->text text="Search album"}" src="{if empty($theme.params.colorpack)}{g->url href="modules/search/images/searchAlbum.gif"}{else}{g->url href='modules/colorpack/packs/'}{$theme.params.colorpack}/images/searchAlbum.gif{/if}">{/if}
    </div>
    {if $block.search.showCheckbox && $theme.item.parentId}
    <div>
      <input type="checkbox" style="vertical-align: middle;" name="{g->formVar var="form[searchAlbum]"}" {if $block.search.defaultCheckboxToOn}checked{/if}/>{if $block.search.checkboxText}{$block.search.checkboxText}{else}{g->text text="Search only in this album"}{/if}
    </div>
    {/if}
    {if $block.search.showAdvancedLink}
    <div>
      <a href="{g->url arg1="view=search.SearchScan" arg2="form[useDefaultSettings]=1"
		       arg3="return=1"}"
	 class="{g->linkId view="search.SearchScan"} advanced">{g->text text="Advanced Search"}</a>
    </div>
    {/if} 
     <input type="submit" id="searchCriteria" class="inputTypeSubmit" name="Button1" value="Show"/>
  <input type="hidden" name="g2_form[useDefaultSettings]" value="1" />
  </form>
{* start of added section*}
<br>
<h2>Keywords:</h2>
<form id="schubidu" action="{g->url}" method="post" onsubmit="submit()">
<div>
     {g->hiddenFormVars}
    <input type="hidden" name="{g->formVar var="view"}" value="search:SearchShowAll"/>
    <input type="hidden" name="{g->formVar var="form[formName]"}" value="SearchShowAll"/>
    <input type="hidden" name="{g->formVar var="form[moduleId]"}" value="GalleryCoreSearch"/>
    <input type="hidden" name="{g->formVar var="form[options][GalleryCoreSearch][descriptions]"}" value="1"/>
    <input type="hidden" name="{g->formVar var="form[options][GalleryCoreSearch][keywords]"}" value="1"/>
    <input type="hidden" name="{g->formVar var="form[options][GalleryCoreSearch][summaries]"}" value="1"/>
    <input type="hidden" name="{g->formVar var="form[options][GalleryCoreSearch][titles]"}" value="1"/>
   </div> 
	
  <select name="g2_form[searchCriteria][]"onchange="Validate(this);">
    <option>black</option>
    <option>blue</option>
    <option>brown</option>
    <option>cold</option>
    <option>city</option>
    <option>green</option>
    <option>grey</option>
    <option>orange</option>
    <option>people</option>
    <option>red</option>
    <option>sand</option>
    <option>sky</option>
    <option>water</option>
    <option>white</option>
  </select>

  <select name="g2_form[searchCriteria][]"onchange="Validate(this);">
    <option>black</option>
    <option>blue</option>
    <option>brown</option>
    <option>cold</option>
    <option>city</option>
    <option>green</option>
    <option>grey</option>
    <option>orange</option>
    <option>people</option>
    <option>red</option>
    <option>sand</option>
    <option>sky</option>
    <option>water</option>
    <option>white</option>
  </select>
  <input type="submit" id="searchCriteria" class="inputTypeSubmit" name="Button1" value="Show"/>
  <input type="hidden" name="g2_form[useDefaultSettings]" value="1" />
</form>
{* end of added section*}

Now, it keeps telling me Array. Ugh. Anyhow, if there's a way to pass words from a drop down to a textfield I'd love to know it, because that's a possible workaround. I could pass drop down info to a hidden text field and then it would pass it to the search engine on submit...

0

You need to set the option value.

example

<select name="foo">
<option value="bar">Bar</option>
<option value="thegecho">Thegecho</option>
</select>

That is it buddy ;)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.