Jump to content

Combined two Search Forms - not functioning


Recommended Posts

Thanks for all the previous help. The web script that I’m modifying has a Search Form that successfully appears when a particular type of page displays:


<?php if (preg_match('#/?sub__(\d)+\b#',$_SERVER['REQUEST_URI'],$matches)) {
echo "<form action='#' method='POST' id='sub_id'>
<input name='search_sub'>
<input type='submit' value='search' />
<input type='hidden' value='{$matches[1]}'> </form>";
} ?>

I wanted to enhance the Form’s appearance and tested this HTML Search Form (which slides the text-enter-field across the page upon selecting the magnify glass icon) seperately successfully:

<div id="sb-search" class="sb-search " >
        <input class="sb-search-input " onkeyup="buttonUp();" placeholder="Enter your search term..." onblur="monkey();" type="search" value="" name="search" id="search">
        <input class="sb-search-submit" type="submit"  value="">
        <span class="sb-icon-search"><i class="fa fa-search"></i></span>

the HTML Search Form has this corresponding js:

function buttonUp(){
         var valux = $('.sb-search-input').val();
            valux = $.trim(valux).length;
            if(valux !== 0){
            } else{

        var submitIcon = $('.sb-icon-search');
        var submitInput = $('.sb-search-input');
        var searchBox = $('.sb-search');
        var isOpen = false;

            if(isOpen == true){

            return false;

            return false;

            if(isOpen == false){
                isOpen = true;
            } else {
                isOpen = false;

I’ve combined the two Search form codes successfully like so:


if (preg_match('#/?sub__(\d)+\b#',$_SERVER['REQUEST_URI'],$matches)) {
echo "<form action='#' method='POST' id='sub_id'>
<input class='sb-search-input ' onkeyup='buttonUp();' placeholder='Enter your search term...' onblur='monkey();' type='search' value='' name='search_sub' id='search'>
<!--<input name='search_sub'>-->
<input class='sb-search-submit' type='submit' value=''>
<span class='sb-icon-search'><i class='fa fa-search'></i></span>
<!--<input type='submit' value='search' />-->
<input type='hidden' value='{$matches[1]}'>


however, now the search Form does not slide the text-enter-field across the page, it is just already 'open' when the page displays.

I’m looking for help with getting the text-enter-field to slide across the page upon selecting the magnify glass icon again, instead of it being 'open' (when the page displays).

If that makes sense I look forward to any assistance.













Edited by Chrisj
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.