We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19427
    • 6 Posts
    Hi!
    I use the cool livesearch function on my site and it works great! I only wonder why I can’t remove the submit button from the html code? Currently I use display:none in the css but I really want to clean up my html and remove it completely. It looks like the javascript needs this submit and uses it in the livesearch mode as well. I’ve also tried to change the input type of the submit to hidden but this breaks ajaxSearch. Can this be fixed for the next version?

    Regards, Mikael
      • 10449
      • 956 Posts
      Just remove the submit button from templates/layout.tpl.html

          <label for="ajaxSearch_submit">
            <input id="ajaxSearch_submit" type="submit" name="sub" value="[+as.submitText+]" />
          </label>
      


      Or even better:

      In snippet.ajaxSearch.php, add this:

      // $AS_showSubmit [0 | 1]
      // Show or hide the submit button (1=true, 0=false)
      $cfg['AS_showSubmit'] = isset($AS_showSubmit ) ? $AS_showSubmit : (isset($__AS_showSubmit ) ? $__AS_showSubmit : 1);
      


      Then you can add this to layout.tpl.html:
      [+as.showSubmit:is=`1`:then=`	
      	<label for="ajaxSearch_submit">
            <input id="ajaxSearch_submit" type="submit" name="sub" value="[+as.submitText+]" />
          </label>
      `+]    
      


      and add this param to your existing AjaxSearch snippet call: &AS_showSubmit=`0`

      Or define it in the config file, i.e. create a global var.
      see configs/default.config.php


      (all of this is untested, btw)
        • 19427
        • 6 Posts
        Thanks for your response but your suggested solution doesn’t work since the ajaxSearch javascript even in livesearch mode uses the submit button in some way. If I remove the button the livesearch will end up in a life time spinning indicator shocked
          • 28033
          • 925 Posts
          Use CSS, via display:none. That worked for me.
            My Snippets
            -> PopUpChunk v1.0