Announcement

Collapse
No announcement yet.

quick search submit on enter

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • quick search submit on enter

    Anyone know how to make the quick search submit when you press enter instead of having to click the button?

    Thanks,
    D.

  • #2
    Re: quick search submit on enter

    This may help. I use this in a login (control) app. Javascript, onload

    Code:
    function submitenter(e) {
     var keycode;
     if (window.event) keycode = window.event.keyCode; // IE
     else keycode = e.which; // FF
    
     if (keycode == 13) {
      document.F1.submit();
      return false;
     } else return true;
    }
    
    document.F1.input_username.onkeypress=submitenter;
    document.F1.input_password.onkeypress=submitenter; 
    
    if (document.F1.input_username.value == '') {
     document.F1.input_username.focus(); 
    } else {
     document.F1.input_password.focus(); 
    }

    Comment


    • #3
      Re: quick search submit on enter

      I think the problem is that there is nowhere to put Javascript in a grid... which is silly. I've tried everything I can think of. I know how to call the button, but everywhere I try to add that javascript it just ignores it.

      Pressing enter already submits the form. The problem is that when you click the quick search button, it actually calls a function to change one of the variables of the form that is being sumitted. So, since I can't add any javascript for some reason, I can't make that call to change before the form is submitted.

      Crazzy...

      D.

      Comment


      • #4
        Re: quick search submit on enter

        Yep, GRID applications suck without any simple way to just drop some javascript or a javascript function into the header. Best solution I came up with which is 1) tedious and 2) not only working is to use the header and footer templates, make a template, put javascript in it and upload it and then assign it to your app, then generate code... and usually, that will work... It is a total pain in the butt, given other apps like to Scott's point just allow easy access to javascript events for SC objects you have in an app...

        I am dealing with this right now with a Grid, I get so sick of spending time trying to do simple things like this, is annoying. But, the benefits of SC still are too great to do without it for sure :-)


        best -

        David

        Comment

        Working...
        X