1
votes

I'm using the Extension Library and XPages to build a web based workflow application. One feature is to prompt a dialog and select the next approver before submitting it forward.

For new documents, the dialog appears, and it also appears when in read mode. It never opens for a saved document. I need it to work in SSJS, though the dialog does open in CSJS. Here is some of the code:

xpMain.xsp contains two custom controls: ccButtons and ccWFloDialogs.

ccButtons "Submit" button:

getComponent('dlgNextOwner').show();

ccWFloDialogs "dlgNextOwner" dialog:

<xe:dialog id="dlgNextOwner" title="Select Supervisor">
    <xe:formTable id="ftDlgNextOwner" formTitle="Select Supervisor"
        formDescription="You may select a different supervisor."
        disableErrorSummary="true">
        <xp:this.facets>
            <xe:formRow id="formRow1" xp:key="footer" for="txtWFloNextOwner"
                labelWidth="125px">
                <xp:inputText id="txtWFloNextOwner" style="width:200px"
                    value="#{viewScope.nextOwner}">
                </xp:inputText>
                <xe:namePicker id="npNextOwner" dialogTitle="Select Supervisor"
                    for="txtWFloNextOwner">
                    <xe:this.dataProvider>
                        <xe:dominoNABNamePicker addressBookSel="all-public"></xe:dominoNABNamePicker>
                    </xe:this.dataProvider>
                </xe:namePicker>
            </xe:formRow>
        </xp:this.facets>
    </xe:formTable>
</xe:dialog>

In CSJS, I can use the following code and it successfully opens the dialog:

XSP.openDialog("#{id:dlgNextOwner}");

I'm also using Mark Hughes' picklist from the extension library, and if I remove the panel which contains the control and data source, the dialog shows up in SSJS! The code is in a custom control, although, if it's directly in the XPage, the problem is the same. Here is the code for the panel:

<xp:panel
        id="vendorDiv">
        <xp:this.data>
            <xp:dominoView
                var="nvVend"
                viewName="V_Vend"
                ignoreRequestParams="true"
                databaseName="other/lookupdb.nsf"
                startKeys="#{javascript:viewScope.srchVend}">
            </xp:dominoView>
        </xp:this.data>
        <xe:formTable
            id="ftGetVendor"
            disableErrorSummary="true"
            labelPosition="above">
            <xe:formRow
                id="frVendor"
                for="cfVendorName"
                label="Name of the Vendor:">
                <xp:text
                    escape="true"
                    id="cfVendorName"
                    value="#{currentDocument.VendorName}"
                    style="width:200px">
                </xp:text>
                <xc:viewpicklist
                    rowsPerPage="15"
                    buttonImage="./add.png"
                    tableClass="tablecellgreen"
                    headerClass="headerclass"
                    rowClass="odd, even"
                    searchBar="false"
                    searchButtonText="Search"
                    searchButtonClass="button2"
                    searchBarClass="headerclass"
                    pagerStyleFirst="navbutton1"
                    pagerStylePrevious="navbutton2"
                    pagerStyleCurrent="navbutton4"
                    pagerStyleNext="navbutton2"
                    pagerStyleLast="navbutton3"
                    typeAheadBar="true"
                    select="Column"
                    onReturn="Set Scope Value"
                    bottomBarClass="bottomround headerclass"
                    cancelButtonText="Cancel"
                    cancelButtonClass="button2 floatthisright"
                    type="Single Value"
                    finishButtonText="Finish"
                    finishButtonClass="button2 floatthisright"
                    multiSelectButtonAddImg="./add.png"
                    multiSelectButtonRemoveImg="./delete.png"
                    picklistButtonClass="button"
                    openDialogWith="Link"
                    picklistLinkImg="./add.png"
                    multiSelectLinkAddImg="./add.png"
                    multiSelectLinkRemoveImg="./delete.png"
                    selectWith="Link"
                    clearSearchImg="./cross.png"
                    SelectCellWidth="30px"
                    dialogID="dlgVend"
                    dialogTitle="Select a Vendor"
                    dialogWidth="80%"
                    refreshID="vendorDiv"
                    ssjsSelectFunction="getVendorInfo"
                    varName="viewScope.vendorInfo"
                    datasrc="nvVend"
                    selectColumn="4"
                    linkImg="./add.png"
                    typeAheadVar="viewScope.srchVend">
                    <xc:this.viewColumn>
                        <xp:value>0</xp:value>
                        <xp:value>1</xp:value>
                        <xp:value>2</xp:value>
                        <xp:value>3</xp:value>
                    </xc:this.viewColumn>
                </xc:viewpicklist>
            </xe:formRow>
            <xe:formRow
                id="frVendorStatus"
                for="cfVendorStatus"
                label="Vendor Registration Status:">
                <xp:text
                    escape="true"
                    id="cfVendorStatus"
                    value="#{currentDocument.VendorStatus}">
                </xp:text>
            </xe:formRow>
            <xe:formRow
                id="frVendorCountry"
                for="cfVendorCountry"
                label="Country Name:">
                <xp:text
                    escape="true"
                    id="cfVendorCountry"
                    value="#{currentDocument.VendorCountry}">
                </xp:text>
            </xe:formRow>
        </xe:formTable>
    </xp:panel>

The requested vendor information populates the fields, without any problem or errors. However, something here seems to prevent dialogs from opening up using SSJS.

Can anyone see anything obvious I'm missing? The data source is in the panel, ignoreRequestParams is true (otherwise it doesn't work).

The main data source is in the entire XPage context. I tried to add the ccWFloDialog custom control outside the main panel, and change the data source to the panel, but that didn't work.

Any ideas?

2
Not much to go on. You will need to expand on the question. If you are new to dialogs then get the OpenNTF extension library sample database and check the code in it.Simon O'Doherty
Thanks, but the ExtLib sample db doesn't have any examples of dialogs in editable XPages. Otherwise, the code is the same. I was hoping someone else had a working example to share.Steve Cochrane
As suggested expand your question. I see no problem to open xe:dialog in read and edit mode.Frantisek Kossuth
Also, check for client side javascript errors in Firebug/JS console, any error in CSJS usually disables all events.Frantisek Kossuth
No javascript errors of any kind when using SSJS. In the SSJS code, I set a couple of viewScope variables, which do get set. The dialog just doesn't open. In CSJS, it opens fine.Steve Cochrane

2 Answers

2
votes

Forget the dialog for now. This is probably data source related. Suggest you get it working just on the xpage first. With visible fields. then maybe use the rendered property to get it working on the xpage similar to how the dialog would appear. Once you have that working then you should be good to apply to dialog. This idea is to just take the dialog out of the equation first to make sure it works normally.

0
votes

Instead, I decided to open the dialogs using CSJS, instead of SSJS. I've changed some of logic, and will have a bit more to do to finish this part of the project. Thanks to all!