how to get detail data for a particular Id on onBlur

Discussions

Web tier: servlets, JSP, Web frameworks: how to get detail data for a particular Id on onBlur

  1. Iam Srinivas Reddy B
    I had a screen on which there is a field(TextBox) called CustomerId.
    And when I enter the Id of the Customer I must get the Address details onBlur of this field.
    I dont want to bring all the customerid and their details
    onLoad of the form.Instead of that I want to interact with the sessionbean which inturn interacts data base once I loose the focus of the text field.

    please help me if U had the solution.
    I will be happy If U reply to my mail Id srinivas.reddy@four-soft.com

    Thanks
  2. Hello,

    What you might try doing is writing a Javascript function that will open a frame with the address information on the field's onblur action. Something like this:

    -----------------------------------------
    <html>
    <head>
    <script language=javascript>
      function showAddressInformation()
      {
        var custid = document.forms[0].customerid.value;
        window.open('show_address_info.jsp?customerid=' + custid);
      }

    </script>

    <body>
    <form action=blah.jsp method=post>
      Customer ID : <input type=text name=customerid onblur='showAddressInformation();'>

    </form>
    </body>
    </html>
    -----------------------------------------

    This will work on all browsers. If you are wanting to show this information on the same page, you will have to write browser-specific code to get it to work in both browsers (IE and Netscape).

    Another alternative is to just write a small applet which represents this field. But that approach is probably overkill. Just open the window on the 'onblur' event... and that should take care of your problem domain.

    Regards,

    Rick