1 2 Previous Next 15 Replies Latest reply: Nov 20, 2003 12:47 PM by 63347 RSS

    lovinput HELP

    403705
      i have been struggling with the list of values and lovinput for a few weeks now .

      currently my problem is i dont know how to get the value selected from the list of values into the lovinput field.

      i have used the following code in javascript to handle the onLovSelect event
      the problem is i dont know how to use the lovWin object provided to get the selected value. all i need is to handle a single selected value.
      can anyone help me on this lovWin object , especially what are its useful methods and properties i can use.


      function SelectCallBack(lovWin, field, event){

      var val = field.value; //the current value of lovinput
      //the lovWin??
      return true;

      }

      thanks a lot for your help ..
      indrika
        • 1. Re: lovinput HELP
          359882
          Take a look here.
          Re: Help!! messageLovInput
          • 2. Re: lovinput HELP
            63347
            You generally shouldn't be using the onLovSelect callback to populate the lovInput. The lovInput text field should be databound. The dataprovider should be updated in your event handler for the lovUpdate event (or the lovSelect event).

            If there is a compelling reason that you NEED to process on the client, the following demo callbacks should give you what you need.

            We have built a complete LOV demo project. It should be available for download from OTN soon.

            function SelectCallBack(lovWin, field, event, mainWin)
            {
            // This function can be used for the onLovSelect callback.
            // It will be called after the select button has been clicked.
            // - lovWin points to the not-yet-closed LOV dialog window.
            // - field points to the lovInput field that triggered this
            // LOV dialog.
            // - event is the window close event
            // - mainWin is the main window that opened the LOV
            //
            //
            // Note: Because IE destroys the items on the window at close() time, but
            // before the close callback, this callback gets called BEFORE the LOV Window
            // is closed under IE. There should be no processing differences, but any
            // confirmation dialogs will come up between the main window, and the still
            // displayed LOV window. This can be very confusing.
            // For this reason, this function is not setup. To test this function, you
            // can add the following attribute to the lovInput element:
            // onLovSelect="SelectCallBack"
            //
            var selVal = '*NULL*';
            if (lovWin)
            {
            if (lovWin.document)
            {
            var doc = lovWin.document;
            if (doc.forms)
            {
            var forms = doc.forms;
            if (forms && forms.length)
            {
            var form = doc.forms[0];
            if (form)
            {
            var proxy = new TableProxy("lovTbl", form.name, lovWin);
            var selRows = proxy.getSelectedRows();
            for(var i=0; i < selRows.length; i++)
            {
            var rowid = proxy.getFormElement("rowid", selRows);
            selVal = rowid.value;
            }
            }
            }
            }
            }
            }
            field.value = selVal;
            return confirm("Click 'OK' to further process, 'Cancel' to use rowid.");
            }
            function _printCallbackParams(params, CBName)
            {
            // This function just raises a confirm dialog listing
            // key:value pairs in the params object
            var str = CBName + ' called with:'
            for (var key in params)
            {
            str += "\nparameter: '" + key +
            "', value '" + params[key] + "'";
            }
            return confirm(str);
            }
            function ValidateCallBack(params)
            {
            // If passed as the onLovValidate attribute, this function is called
            // before the lovValidate event is fired.
            // This gives the developer a chance to add, delete or change
            // parameters that will be sent with the lovValidate event
            return _printCallbackParams(params, 'pre-validate Callback');
            }
            function InitCallBack(params)
            {
            // If passed as the onLovInit attribute, this function is called
            // after validation, but before the LOV dialog window is launched.
            // This gives the developer a change to change the parameters that
            // are going to the dialog window.
            //
            // The params object contains all the parameters which will end up
            // on the URL.

            // Add our own parameter. This will end up as a parameter on the
            // LOV dialog window URL.
            // (http://...?...&myParam=foo)
            params["myParam"] = "foo";

            return _printCallbackParams(params, 'InitCallback');
            }

            ...
            <lovInput name="lov1"
            id="LOV1"
            destination="listOfValues_Dialog.uix"
            shortDesc="Click to select a predefined value"
            partialRenderMode="self"
            onLovInit="InitCallBack"
            onLovValidate="ValidateCallBack"
            validateBlanks="true"
            showWindow="${uix.eventResult[LOV1'].showWindow}"
            text="${uix.data.fieldData['LOV1'].fieldText}"/>
            ...
            • 3. Re: lovinput HELP
              403705

              THANKS A LOT BUD

              I JUST GOT LOVINPUT FIELD WORKING ... THANKS TO YOU.

              I MIGHT NEED MORE HELP LATER ON THOUGH

              INDRIKA
              • 4. Re: lovinput HELP
                403705
                THANKS A LOT BUD

                I JUST GOT LOVINPUT FIELD WORKING ... THANKS TO YOU.

                I MIGHT NEED MORE HELP LATER ON THOUGH

                INDRIKA
                • 5. Re: lovinput HELP
                  63347
                  Great, glad to be of help.
                  • 6. Re: lovinput HELP
                    407392
                    is the LOV demo project available yet??

                    regards,
                    vasanth
                    • 7. Re: lovinput HELP
                      407392
                      hi Bud,
                      I have a question about the onLovSelect tag. If I have this tag in the script as u have mentioned in this forum my popup window is not poping up. If i dont have the tag then the window pops up but I cannot do any select?? am i missing any thing here.??

                      regards,
                      vasanth
                      • 8. Re: lovinput HELP
                        407392

                        the question concerned about this post is solved. The popup is showing up now. How ever what is the meaning of the script error (_monitor undefined)?

                        and if I have a choice list with some values and I select one of the values and hit select the call back returns with empty string for the returned value ie I get this

                        SelectCallBack called fieldName:'TestingLOV'value:'

                        any help here.

                        regards,
                        vasanth
                        • 9. Re: lovinput HELP
                          63347
                          The posting of the LOV demo is being handled by another group. I don't know when it will be posted, but I've been told "soon."

                          The _monitor undefined error seems to point to a mismatched MarlinCore. You probably have 2.1.x installables, but you're running against a 2.2.x UIX library. If you shutdown JDev, rename or remove the cabo directory under your project, then restart JDev and re-run the project a new, up-to-date installables tree will be built.

                          I don't understand the third question. You're supposed to be using a listOfValues element, not a choice element.
                          • 10. Re: lovinput HELP
                            407392
                            thanks bud,
                            yes as u 've said its the ListOfValues element but in the <contents> section of this tag I have a choice and a list so that I can select one option. I think the data in the contents should get populated with the information provided by the user the first time ie., from the <lovInput> text. But if I have a list hard coded and I select one value and hit "select" shouldn't I be redirected back to the main page with my selection??

                            regards,
                            vasanth
                            • 11. Re: lovinput HELP
                              407392
                              hi bud,
                              with respect to the script error in my previous post........I am using Jdev 10g preview version. My complete project is developed in it. Now will I still have the 2.1.x and 2.2.x installables problem??

                              regards,
                              vasanth
                              • 12. Re: lovinput HELP
                                63347
                                You shouldn't. However, the problem you're seeing is caused by a component referencing a javascript method that was introduced in UIX 2.2.0. It can't be found, so the it seems that there is a library mis-match. The method is defined in MarlinCore.js which lives in ...YourWorkspace\YourProject\public_html\cabo\jsLibs. The version you have will be in abbreviated format, but the method names will be correct.

                                I see that you have also posted a new thread. Any followup should probably go there. I'll put a reference to this thread in that one ( lovInput )
                                • 13. Re: lovinput HELP
                                  63347
                                  There are two things amiss.
                                  1.) You should databind the value of the searchText attribute of the listOfValues element. When you get the lovFilter event, it will contain the partial text that the user has entered. You should use that text to filter your full dataset, and present the results. F'rinstance if the dataset is 8000meter peaks and the user types 'e' your listOfValues table should contain only 'Everest' if they typed 'k' the table should contain K2 and Kangchenjunga. If the search text was null, the table should contain all 14 etc.
                                  2.) You should have a table as the contents, not a choice. You'll get regular table navigation events for which you should save the users selections, but you'll get a final lovSelect event when the user has finally clicked 'Select.' At that point you only have row numbers which you map back to your filtered dataset to get the values that you should bind to the lovInput's text field.
                                  • 14. Re: lovinput HELP
                                    407392
                                    thanks so much Bud,
                                    could you please give me an example of this.

                                    In my popup window I have this
                                    <uix:listOfValues title="LOV#1" destination="Test.jsp" searchText="${dataBinding}" >
                                    the searchText in the above code had to be dataBound to the name of the lovInput in the main page??

                                    here is the page that has the lovInput
                                    <uix:lovInput name = "TestingLOV" destination="Popup.jsp" 
                                        onLovSelect="SelectCallBack"  />
                                    the function SelectCallBack is in the main page in my case (Test.jsp).

                                    regards,
                                    vasanth
                                    1 2 Previous Next