7 Replies Latest reply: May 9, 2012 5:25 AM by Peddi RSS

    Issue on implimenting the enter key for a custom search

    user13051010
      I am having arequirment is to impliment "search" functionality on click of
      enter key pressed.

      I have tried with below code in my ProcessRequest()

      --------------------------------------------------------------------------------

      OAMessageTextInputBean
      claimNumBean=(OAMessageTextInputBean)webBean.findChildRecursive("searchClaimNo");

      if (claimNumBean != null)
      {
      System.out.println("---->Button bean is not null");
      Hashtable params = new Hashtable();
      params.put ("SearchBtn", "SearchBtn");
      claimNumBean.setAttributeValue(OAWebBeanConstants.ON_KEY_PRESS_ATTR,
      new OABoundValueEnterOnKeyPress( pageContext,
      "DefaultFormName", //enclosing form name
      params,
      true, //client validated
      true)); // server validated
      }

      --------------------------------------------------------------------------------

      By this i am able to achive the search funcionality.
      There are few other buttons in my page,

      But the other button like my check box, I am not able to check. When I
      am clicking on check box , It is directly reloads the page again and I
      am not able check, The default page is getting loaded.So finally I am
      not able to do any other operation except that enter key press. One PPR(firePartialAction) is attached this check box
      PPR is not working after putting this code

      Please guide me what to do that , is tehre any restriction.
        • 1. Re: Issue on implimenting the enter key for a custom search
          Peddi
          Please use OAF search bean for searching.

          Regards,
          Peddi.
          • 2. Re: Issue on implimenting the enter key for a custom search
            user13051010
            Hi,

            I have already tried with, using the simple search region.
            But with simple search region I am not able to achive my requirments.
            On search I have to display records in two table, one simple table and other is in Advance table.
            In Advance table there are some fields need to be updated.
            and there are two PPR in thepage one which was enableing two buttons and the other one which makes some fields editable.
            Do you have any idea for this kind of requirments.

            Thanks!
            • 3. Re: Issue on implimenting the enter key for a custom search
              Peddi
              As you are capturing and handling the Search by yourself, you have to execute two queries by yourself in processFormRequest().

              I assume that you have two queries for the tables you are displaying. So capture the Search(Pressing Enter key comes to this) and run the VOs manually by getting the data from the search fields.

              Your search bean doesn't care about what you do in the advanced table but make sure you commit the data before querying(I mean commit the data before you execute the query again.) or it will throw stale data error.

              Have a look at below post for SAMPLE code
              Re: Search Criteria and results are getting lost while after Drill Down

              Regards,
              Peddi.
              • 4. Re: Issue on implimenting the enter key for a custom search
                user13051010
                Hi Peddi,

                Thanks a lot for your reply.
                I am having two VO for two result table.
                I am capturing the search criteria value and executing both the query.
                I am able complete the search operation.

                After that issue I am facing the issue.

                For complete the search on press of Enter key I have added this below code in my Processrequest()

                if (claimNumBean != null)
                {
                System.out.println("---->Button bean is not null");
                Hashtable params = new Hashtable();
                params.put ("SearchBtn", "SearchBtn");
                claimNumBean.setAttributeValue(OAWebBeanConstants.ON_KEY_PRESS_ATTR,
                new OABoundValueEnterOnKeyPress( pageContext,
                "DefaultFormName", //enclosing form name
                params,
                true, //client validated
                true)); // server validated
                }

                I am handling the search properly, and able to get search result values in both the tables.

                But as I told in Bottom of my page there is a check box and 3 buttons.

                1. "Reject All"
                2. "Validate"
                3. "Cancel"

                By default after search happens the two button- "Reject All", "Validate" will be disabled.
                Once user will check the check box then two button should Enabled. But this is not happening after using above code in PR().
                If I removes that(above) code from processRequest() then All PPR in my page works fine, I am able to enable and disable the buttons.

                So i am not able to know what is the issue, is there any restriction on "OABoundValueEnterOnKeyPress" with PPR.

                Please guide me and check the code that I am using above.

                Thanks!
                • 5. Re: Issue on implimenting the enter key for a custom search
                  Peddi
                  I don't understand the use of the below code. Could you please explain.

                  if (claimNumBean != null)
                  {
                  System.out.println("---->Button bean is not null");
                  Hashtable params = new Hashtable();
                  params.put ("SearchBtn", "SearchBtn");
                  claimNumBean.setAttributeValue(OAWebBeanConstants.ON_KEY_PRESS_ATTR,
                  new OABoundValueEnterOnKeyPress( pageContext,
                  "DefaultFormName", //enclosing form name
                  params,
                  true, //client validated
                  true)); // server validated
                  }

                  If you remove this code, are you able to query the VOs properly?

                  Regards,
                  Peddi.
                  • 6. Re: Issue on implimenting the enter key for a custom search
                    user13051010
                    As I am not using simple search ,

                    In my page to enable the enter key for search this below code is used.
                    • 7. Re: Issue on implimenting the enter key for a custom search
                      Peddi
                      It's always preferable to use search bean where possible. It queries the data by itself. If you want the search to be handled manually, then you can do it by yourself also but use search bean. But avoiding search bean all together will leads to problems. Try to use the search bean instead.

                      Regards,
                      Peddi.