only allow users to select items from a listbox or items from drill around

 4 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
LisaN
Veteran Member
Posts: 53
Veteran Member
    We have a DS form for RQ10. Some of the fields are either listboxes or text fields with drill. Is it possible to only allow the users to select from the items in the listbox or drill-around. We don't want the user to manually enter data in the fields. Is this possible?
    So far I haven't found a way.

    For example: the 'Minor Class' field is a text field with drill-around. Can we make the field so the user can only select the options from the drill? the Warranty field is a listbox; we want the user to only select from the dropdown.

    Thank you.
    David Williams
    Veteran Member
    Posts: 1127
    Veteran Member
      The only other option I can think of is to edit check the value after they move off of the field and if they entered something that's not in your list then alert a message indicating the value is invalid.
      David Williams
      Robert Spurr
      Veteran Member
      Posts: 130
      Veteran Member
        We created a form that allows users to select an alternate requester ID but only those that had been defined for the user. It is similar to your solution and thought the code might provide some insight on how you could achieve your goals. The form started as a blank RQ04 and we store the values in the EDI Sub table.

        function FORM_OnAfterDataInit()
        {
        //
        //Builds Textarea1 display
        //
        var vCommit = "This form is only for those individuals authorized ";
        vCommit = vCommit + "to have multiple requester ID's. ";
        vCommit = vCommit + "If the dropdown displays no options and it should please contact ";
        vCommit = vCommit + "MMIS.";

        lawForm.setFormValue("textarea1",vCommit);

        //
        //Stores users ID and Prodcutline
        //
        var strID = portalWnd.oUserProfile.getAttribute("ID");
        var strPDL = portalWnd.oUserProfile.getAttribute("productline");

        //
        //DME call to return individuals assigned to route inbaskets
        //
        var s = "?PROD="+strPDL;
        s += "&FILE=EDSUBTBL&INDEX=EDSSET1&KEY=CHANGE_REQUESTER="+strID;
        s += "&FIELD=EXTERNAL-VALUE";
        s += "&OUT=XML&MAX=25";

        //
        //Makes call
        //
        var sReturn = portalWnd.httpRequest(portalWnd.DMEPath + s);

        //
        //Checks for errors
        //
        if (!sReturn || sReturn.status)
        {
        var msg="Error calling DME ";
        msg += (sReturn
        ? "(status code): " + sReturn.status
        : "bad server response.");
        alert(msg);
        return true;
        }

        //
        //Assigns return to a new object
        //
        var vObjDMEXML = new portalWnd.DataStorage(sReturn);

        //
        //Breaks object into records
        //
        var vRecord = vObjDMEXML.document.getElementsByTagName("RECORD");

        //
        //Checks to see if no data was returned
        //
        if (vRecord.length == 0)
        {
        return true;
        }
        //
        //Variables to load listbox
        //
        var strRequester = document.getElementById("VALUES_l183");
        var ListVal1;
        //ListVal1 = document.createElement("span");

        //
        //Fill List Box
        //
        for (var i=0;i {
        ListVal1 = document.createElement("span");
        var vCols = vRecord.getElementsByTagName("COL");
        var vAppName = vCols[0].firstChild.data;

        ListVal1.setAttribute("text",vAppName);
        ListVal1.setAttribute("tran",vAppName);
        ListVal1.setAttribute("disp",vAppName);
        strRequester.appendChild(ListVal1);

        }
        return true;
        }

        function BUTTON_OnClick(id, row)
        {
        //
        //Stores users ID and Prodcutline
        //
        var strID = portalWnd.oUserProfile.getAttribute("ID");
        var strPDL = portalWnd.oUserProfile.getAttribute("productline");
        var newRequester = lawForm.getFormValue("select20");

        //
        //Blank Value
        //
        if (newRequester == "")
        {
        alert("You need to select a requester");
        return true;
        }

        //
        //DME call to validate selection
        //
        var s = "?PROD="+strPDL;
        s += "&FILE=EDSUBTBL&INDEX=EDSSET1&KEY=CHANGE_REQUESTER="+strID+"="+newRequester;
        s += "&FIELD=EXTERNAL-VALUE";
        s += "&OUT=XML&MAX=1";

        //
        //Makes call
        //
        var sReturn = portalWnd.httpRequest(portalWnd.DMEPath + s);

        //
        //Checks for errors
        //
        if (!sReturn || sReturn.status)
        {
        var msg="Error calling DME ";
        msg += (sReturn
        ? "(status code): " + sReturn.status
        : "bad server response.");
        alert(msg);
        return true;
        }

        //
        //Assigns return to a new object
        //
        var vObjDMEXML = new portalWnd.DataStorage(sReturn);

        //
        //Breaks object into records
        //
        var vRecord = vObjDMEXML.document.getElementsByTagName("RECORD");

        //
        //Checks to see if no data was returned
        //
        if (vRecord.length == 0)
        {
        alert("You are not authorized to use requester ID ("+ newRequester + ") with this form");
        return true;
        }

        //
        //Open RSS with the new requester
        //
        var vURL = "/rss/html/index.htm?newreq=true&requester=" + newRequester;
        portalWnd.openWindow(vURL)

        return true;
        }
        LisaN
        Veteran Member
        Posts: 53
        Veteran Member
          Thanks for your help David and Robert. After playing around with the field I discovered a trick. If I change the listbox width to -1 (neg. 1) the display changes so that the drop-down arrow is on the left and the display is on the right. Data can't be keyed in the field.

          for the text box with drill, I changed the width to 0 and added a text box to hold the fields info. A width of -1 still allowed the user to enter data.

          Hopefully the -1 isn't a bug that they fix down the road.
          Thanks again.
          Lisa
          David Williams
          Veteran Member
          Posts: 1127
          Veteran Member
            I'll have to remember this "work around" and hope Lawson doesn't fix it.
            David Williams