Sub Form or new form open with a button click

I am using Metastorm 9.x
My objective is to allow the user to select a list of names from a grid and as they select the names it populates another grid showing them the names they have chosen or that already exist previously for the field that these names will reside in. The field (call it SelectedNames) will have the names listed as such (name1, name3, name2, ...) The simplest way I can make this work is to open up another form (or a sub form) that shows these two grids where they can either remove names from the 'selected names grid' or add names to the selected names grid by dbl clicking on the available names grid. When they are done, the can either submit or close the form which then would take the names in the selected names grid and concatenate them into the initial field on the main form. There are 5 rows of 'selected names' that they can add or remove names from. So I would like to do this in a clean way and thought doing this (manipulation of the names) in a separate form would be the easiest rather than having two grids appear on the main form when a button is clicked - plus I don't really have a good way of them submitting/canceling the process unless I do this all in a separate form. Or does anyone have a better way to do this? Otherwise my main question is how can I use a command button to 'open' up this 2nd form that has the 2 grids in it. OR is it easier to just have a subform layered on the main form that is initially hidden but appears when the button is clicked?

Thoughts?

Thanks

Tagged:

Comments

  • Depending on you exact needs, it may be possible to use list boxes instead of grids, but otherwise the logic would be similar.

    I do something similar by calling an Admin form (which happens to use list boxes instead of grids, but either works) which is opened in a modal fashion. That way the user has to OK (submit) or Cancel to get back to the original form. If they submit I have a "refresh" button presses on the calling form to the values get updated. However, if the result is a list/text or other "simple" data type returning the selected value directly is also possible (I do this for another pop-up option.)

  • Brian, Thanks for the feedback. But I don't know how to 'Call' a form from someone clicking on a button (in version 9.x).
    How do you do that?

    And subsequently, how do you do a refresh on the calling form to the values that need to be updated?

    Thanks

  • Below is an MBPM code fragment where I pass in a values into the form, then process its response. (e.g. look up a name/ID and return its result). sArgs are the values to pass into the calling Admin form. sReturned is the return result from the remote window. In this case we are opening a modal window (presumes I.E., I need to make that more generic someday)

    var sArgs = "&FilterParams=Search_Name;"+sfldValueDisp+";Text:Search_Type;"+fldType+";Text";   // this will directly populate the indicated fields with the passed in values
    var sReturned = window.showModalDialog("/Metastorm/eForm.aspx?Map=<<AdminFormGroupName>>&Action=<<AdminFormName>>&Client=External"+ sArgs,"","center:yes;resizable:no;titlebar=no;status=no;dialogHeight:300px;dialogWidth:350px");
    if ((sReturned == undefined) || (sReturned == "")) // Check if no results (i.e. cancel)
    {  // clear values on form
        setField(fldName,"","");   // blank out the field (or whatever is appropriate in your case)
        $find(fldName).focus();   // put focus on the cleared field (if appropriate)
    }   // undefined/empty (if)
    else   // Something was returned, process it
    {
        var btnNameRefresh = "btn"+fldName+"Refresh";  // form button name
        setField(fldName,"",sReturned);   // Set the return result in data field
        buttonClick(btnNameRefresh);   // Click a form button (hidden or otherwise) to force a refresh
    }   // have value (else)
    

    on the Admin form itself, if the user presses OK, return the result via:

    window.returnValue = sToReturn;
    window.close();
    return true;
    

    else if they press cancel we return an empty string (""). In either case the window.close() and return true are needed to close out the modal form correctly.