We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6723
    • 93 Posts
    I’m having real problems and getting confused trying to style and locate the input field and the submit button for AjaxSearch - I hope someone can help me please.

    I’m using modx-1.0.2 on php-4.4.8-1 and this is an example page to show my problem;

    http://pulse-test.co.uk.s59294.gridserver.com/about/pulse-connect.html

    Basically I want the input and submit to line up on one line, in line with the menu created.

    Here is the HTML from the header to the content section with the snippet call;

    <div id="container">
    {{header}}
    <div id="navigation-container">
    {{navigationmenuabout}} 
    <div id="search">[!AjaxSearch? &ajaxSearch=`0` &AS_showResults=`0` &AS_landing=`57`!]</div>	
    </div>
    <div id="wideHead">
    <h1>[*longtitle*]</h1> 
        <!-- end #wideHead -->
      </div>
    
     <div id="column1">
    [*#content*]


    The navigation-container holds both the menu system and the search elements in two child layers - the ’navigationmenuabout’ chunk holds all the menu info and you can see the ’search’ div. Removing the snippet call and putting in a blank field with input and submit, everything is fine and lines up.

    So I’ve been looking for hours at CSS to style the Ajaxsearch elements with little success. Here is the CSS

    #search {float: right;
    	width: 150px;
    	height: 30px;
    	} 
    
    #ajaxSearch_form {
      
     width: 100px;
     height: 30px;
    }
    
    fieldset {
    border: none;
    padding: none;
    margin: none;
    }
    
    #ajaxSearch_input {
               width: 50px;
              /* display: inline;
               height: 17px;
               margin: 0 3px 0 0;
               padding: 3px 0 0;
               vertical-align: top; */
    }
    
    #ajaxSearch_submit {
               background-color: #000080;
               color: #d0d0ff;
               font-weight: bold;
               display: inline;
               height: 22px;
               line-height: 22px;
               margin: 4px 0 0 0;
    }


    Can anyone help please it’s driving me crazy and I need to get it fixed. Thanks, David


      • 18913
      • 654 Posts
      Hi,
      I just took a look at that link and it appears you’ve taken out the search call. So I can’t tell exactly what the problem is.

      However, if it is the same one I beat my head against a wall on, this is what I found :
      When I put in the Ajaxsearch call with the default template I would get an extra bit of spacing above the input box that I couldn’t style away. So the input form was dropped down lower than the horizontal menu. Looking at the *generated* source, I found some sort of character being introduced as a result of the logic test in the template which determines whether or not the form was to be displayed. Since I didn’t need that test anyway, I deleted it and the extra space went away.

      Hope that helps,
      Matt
        • 6723
        • 93 Posts
        Yeah i think i’ve got it - didn’t see any weird characters - but did what others have done, moved the layout from the snippet/template area and put it into a chunk and referenced it ’&tplLayout’ in the snippet and I was suddenly able to alter the CSS as normal. Thanks for looking.
          • 32453
          • 3 Posts
          I have spen 2 days trying to fix this. I have that space around my search box and I do not know how to get rid of it. I see that you have figured out how to fix it , but I do not understand what you did. could you please clarify what I need to do to take that extra space out?
            • 5811
            • 1,717 Posts
            Did you read this post : http://modxcms.com/forums/index.php/topic,45957.msg276724.html#new
            This unwanted character is due to the format of the templates. If you use UTF-8, save your templates as UTF-8 without BOM. For that use an editor, like notepad++ or an equivalent.
              • 32453
              • 3 Posts
              THANK YOU SO MUCH! This is the fix I was looking for, just to be clear for others who experience this issue this is what I did:
              1. Downloaded and installed Notepad++ (just search at google for this program)
              2. Opened the file ajaxsearch/templates/layout.tpl.html in Notepad++
              3. In Notepad++ I click on "Encoding" and then selected "Encode in UTF-8 without BOM"
              4. I saved this file over the original layout.tpl.html file and then uploaded the new file to the server into the
              assets/snippets/ajaxSearch/templates/

              I Love ModX! thanks again for the help