1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Search form assistance req'd please

Discussion in 'Templates, HTML, CSS, and Design Help' started by jason1971, Dec 19, 2013.

  1. jason1971 Customer

    Hi there,

    I am adding a quick search form to my home.tpl page, but I am have a couple of issues with a dropdown option and checkbox I hope to get help with.

    1. In my admin > Categories > Extra Fields > I have added a new dropdown option called
    "Property Sleeps" with the internal name set as "sleeps"

    I have done the same but created a checkbox called "Pets Welcome" with the internal name set as "pets"

    Now my issue is with the search form is that I am not sure how to call the required answers

    <select name="Property_Sleeps"> <- I am not sure whether this is the correct setup ?

    <option value=" ">Any</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6>6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    <option value="9">9</option>
    <option value="More_Than_10">10+</option>
    </select>

    and this is how I currently have my checkbox setup

    Pets Welcome <input type="checkbox" name="Pets_Welcome" value="True">

    The checkbox only has one option set as "yes", so I am not sure whether the name is to be set as the checkbox name itself or the internal name, and how should the value be set.

    I am really sorry to keep asking questions, but i'm nearly finished now

    Thanks

    Jason
  2. Mike-N-Tosh Owner

    Jason,

    There is no need to apologize for asking questions. That is the whole point of why we have these forums is to ask questions and get answers.

    Regarding your question:
    In order for the search to use extra fields in the search form, you need to name them properly. Go to the advanced search (yoursite.com/search.php) and select a category that has extra fields assigned to it and input something and conduct the search. Now look at the url and you will notice that the extra fields are in the format of "optXX=input+text".

    So the name of your extra field inputs in search needs to be named accordingly with "opt" and the extra field ID.
    <select name="opt19" value=""> ...

    Again, you need to make sure you put YOUR extra field ID after the "opt" in YOUR template.

    Also, checkbox fields are used to allow multiple entries. In a Yes/No (boolean field), you would normally use either a radio button (it's either selected or not) or a drop down. A checkbox will work, it's just not good practice to use in that way.
  3. jason1971 Customer

    Hi Mike,

    Many, Many thanks for your help, and I now understand how it needs to go. that's the good news !

    Ok, my issue is that no result are showing up from the selected options however, after looking at the searchresults URL I have noticed the following + marks which I know is what is stopping the results from coming through, but I am unsure what I need to do to get rid of them

    This is how I set it up, I assume this is correct.

    <td><select name="type" id="type">
    <option value=" ">Search All Holiday Homes</option>
    <option value="4">Apartments</option>
    <option value="5">Barns</option>
    <option value="3">Bunglows</option>
    <option value="1">Cottages</option>
    <option value="2">Houses</option>
    <option value="7">Log Cabin</option>
    <option value="6">Static Caravans</option>
    <option value="8">Unique &amp; Unusual Holiday Homes</option>
    </select></td>
    </tr>
    <tr>
    <td>Bedrooms Required:</td>
    <td><select name="opt2">
    <option value=" ">Any</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7+">7+</option>
    </select></td>
    </tr>
    <tr>
    <td>Needs to Sleep:</td>
    <td><select name="opt3">
    <option value=" ">Any</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    <option value="9">9</option>
    <option value="More_Than_10">10+</option>
    </select> &nbsp;people</td>
    and this is the results I get from search

    /searchresults.php?type=+&opt2=+&opt3=+&opt27=Yes&Submit=Search+holiday+homes

    Any Thoughts ?

    Cheers

    Jason
  4. jason1971 Customer

    has anybody got any idea what is wrong
  5. jason1971 Customer

    BRAIN STARTED TO WORK AGAIN - ISSUE SOLVED !

Share This Page