MyBB Community Forums

Full Version: I need help fixing my search bar
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to figure out what I'm doing wrong and hopefully learn from this mistake. 
That's the best thing about web designing right? Smile

When I type inside the search bar and clicked the button, it showed up no results (like I didn't type anything). 
Would appreciate it if anyone could point out what I am doing wrong. 


Preview of my search bar.

[Image: 15c0f3d08e243900e38f8ac8f303edd0.png]

HTML:
<li id="custom_search">
    <form method="post" action="search.php">
        <input type="hidden" name="action" value="do_search" />
        <input type="text" name="custom_search_text" id="custom_search_text" placeholder="Search"/>
        <input type="submit" class="button" name="custom_search_button" id="custom_search_button" value="">
    </form>
</li>

CSS:
#custom_search {
    list-style-type: none;
    display: inline-block;
    margin-top: 15px;
}

#custom_search_text{
    width: 180px;
    padding: 15px 0 15px 20px;
    font-size: 14px;
    font-family: Montserrat, sans-serif;
    border: 0 none;
    height: 35px;
    margin-right: 0;
    color: #2a2b2a;
    outline: none;
    background-image: url(images/custom/white_filter.jpg);
    background-repeat: repeat;
    float: left;
    box-sizing: border-box;
    transition: all 0.15s;
}

::-webkit-input-placeholder { /* WebKit browsers */
    color: #3c91bc;
}

:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
    color: #3c91bc;
}

::-moz-placeholder { /* Mozilla Firefox 19+ */
    color: #3c91bc;
}

:-ms-input-placeholder { /* Internet Explorer 10+ */
    color: #3c91bc;
}

#custom_search_text:focus {
    background-image: url(images/custom/white_filter.jpg);
    background-repeat: repeat;
}

#custom_search_button {
    border: 0 none;
    background-image: url(images/custom/search.png);
    background-position: center;
    background-repeat: no-repeat;
    width: 40px;
    float: left;
    padding: 0;
    text-align: center;
    height: 35px;
    cursor: pointer;
    border-radius: 0px;
}

I got part of the html/css from another website that was showing the design I needed.

So I used that html search bar and trying to "blend" in the MyBB function into it. If anything, I will use the MyBB basic code and then style it into the css I found.

For the code above, I put it together in jsfiddle so you can look at it.
https://jsfiddle.net/L6h3jeox/



Still needing help with this. I've rewrote the code again in a different way, but I wasn't able to add an image (search icon) to my button since I already have a background image on that button.

The search work for this one, but I can't add an image on the button. Sad

HTML
<li id="custom_search">
    <form method="post" action="search.php">
        <input type="hidden" name="action" value="do_search" />
        <input type="text" class="textbox" name="keywords" size="13" maxlength="250" />
        <input type="submit" class="button" name="submit" value="" />
    </form>
</li>

CSS
#custom_search {
    list-style: none;
    display: inline-block;
    margin-top: 15px;
    position: relative;
}

#custom_search input.textbox {
    width: 180px;
    height: 35px;
    border-radius: 0px;
    border: none;
    padding: 0;
    background-image: url(images/custom/white_filter.jpg);
    background-repeat: repeat;
    float: left;
}

#custom_search input.button {
    width: 40px;
    height: 35px;
    border-radius: 0px;
    border: none;
    padding: 0;
    background-image: url(images/custom/white_filter.jpg);
    background-repeat: repeat;
}

#custom_search input.img {
    background-image: url(images/custom/search.png);
    background-position: center;
    background-repeat: no-repeat;
    width: 20px;
    height: 20px;
}

JSFiddle: https://jsfiddle.net/tthhb7yg/  (Didn't add placeholder yet for this.)

Please help me with this! I can't move on with my project until I figure this out. Sad