rice-framework/krad-web/src/main/webapp/krad/scripts/krad.lookup.js
/**
 * Submits the form based on the quickfinder action identified by the given id and display the result content in
 * a dialog using a modal. If we are not currently in a modal, we will request a URL to be used in the created dialog's
 * iframe content. Otherwise, the internal iframe of the dialog will be redirected.
 *
 * @param quickfinderActionId id for the action component that the fancybox should be linked to
 * @param lookupReturnByScript boolean that indicates whether the lookup should return through script
 *        or via a server post
 * @param lookupDialogId(optional) id of dialog to use, if not set Uif-DialogGroup-Iframe will be used
 */
Submits the form based on the quickfinder action identified by the given id and display the result content in
a dialog using a modal. If we are not currently in a modal, we will request a URL to be used in the created dialog's
iframe content. Otherwise, the internal iframe of the dialog will be redirected.

@param quickfinderActionId id for the action component that the fancybox should be linked to
@param lookupReturnByScript boolean that indicates whether the lookup should return through script
or via a server post
@param lookupDialogId(optional) id of dialog to use, if not set Uif-DialogGroup-Iframe will be used
Submits the form based on the quickfinder action identified by the given id and display the result content in a dialog using a modal . If we are not currently in a modal we will request a URL to be used in the created dialog ' s iframe content . Otherwise the internal iframe of the dialog will be redirected . @param quickfinderActionId id for the action component that the fancybox should be linked to @param lookupReturnByScript boolean that indicates whether the lookup should return through script or via a server post @param lookupDialogId ( optional ) id of dialog to use if not set Uif - DialogGroup - Iframe will be used
function showLookupDialog(quickfinderActionId, lookupReturnByScript, lookupDialogId, dialogId) {
    jQuery(function () {
        var data = {};
        var submitData = jQuery("#" + quickfinderActionId).data(kradVariables.SUBMIT_DATA);
        jQuery.extend(data, submitData);
        if (!lookupReturnByScript) {
            dirtyFormState.skipDirtyChecks = true;
        }
        var renderedInDialog = isCalledWithinDialog();
        if (!renderedInDialog) {
            if (top === self) {
                data['actionParameters[returnTarget]'] = '_parent';
            } else {
                data['actionParameters[returnTarget]'] = 'iframeportlet';
            }
            var baseURI = this.location.href;
            if (baseURI.indexOf("?") > -1) {
                baseURI = baseURI.substring(0, baseURI.indexOf("?"));
            }
            data['actionParameters[returnLocation]'] = encodeURIComponent(baseURI);
            data['actionParameters[renderedInDialog]'] = true;
            data['actionParameters[returnByScript]'] = lookupReturnByScript;
            data['actionParameters[methodToCall]'] = "start";
            data['actionParameters[flow]'] = "start";
            data['actionParameters[returnFormKey]'] = jQuery("#" + kradVariables.FORM_INFO_ID).children("input[name='formKey']").val();
            if (dialogId) {
                data['actionParameters[dialogId]'] = dialogId;
            }
            var lookupParameters = data['actionParameters[lookupParameters]'];
            if (lookupParameters !== "" && typeof lookupParameters !== "undefined") {
                var params = lookupParameters.split(",");
                for (var i = 0; i < params.length; i++) {
                    var param = params[i];
                    var lookupField = param.substring(param.indexOf(":") + 1);
                    var lookupFieldName = param.substring(0, param.indexOf(":"));
                    var lookupValue = "";
                    if (jQuery("[name='" + escapeName(lookupFieldName) + "'][type='radio']").length > 0) {
                        lookupValue = jQuery("[name='" + escapeName(lookupFieldName) + "']:radio:checked").val();
                    } else {
                        lookupValue = jQuery("[name='" + escapeName(lookupFieldName) + "']").val();
                    }
                    if (lookupField !== "" && typeof lookupField !== "undefined" && lookupValue !== "" && typeof lookupValue !== "undefined") {
                        data['actionParameters[lookupCriteria[&quot;' + lookupField + '&quot;]]'] = lookupValue;
                    }
                }
            }
            var lookupUrl = data['actionParameters[baseLookupUrl]'] + "?";
            for (var key in data) {
                if (key.indexOf("actionParameters") !== -1) {
                    var parameterName = key.replace("actionParameters[", "").replace("]", "").replace(new RegExp("&quot;", 'g'), "'");
                    lookupUrl += parameterName + "=" + data[key] + "&";
                }
            }
            lookupUrl = lookupUrl.substring(0, lookupUrl.length - 1);
            lookupUrl = lookupUrl.replace(/&amp;/g, '&');
            openIframeDialog(lookupUrl, lookupDialogId);
        } else {
            data['actionParameters[renderedInDialog]'] = 'true';
            data['actionParameters[returnTarget]'] = '_self';
            var flow = jQuery("input[name='" + kradVariables.FLOW_KEY + "']").val();
            if (flow !== "") {
                data['actionParameters[flow]'] = flow;
            }
            nonAjaxSubmitForm(data['methodToCall'], data);
        }
    });
}
function showLookupDialog ( quickfinderActionId , lookupReturnByScript , lookupDialogId , dialogId ) { jQuery ( function ( ) { var data = { } ; var submitData = jQuery ( "#" + quickfinderActionId ) . data ( kradVariables . SUBMIT_DATA ) ; jQuery . extend ( data , submitData ) ; if ( ! lookupReturnByScript ) { dirtyFormState . skipDirtyChecks = true ; } var renderedInDialog = isCalledWithinDialog ( ) ; if ( ! renderedInDialog ) { if ( top === self ) { data [ 'actionParameters[returnTarget]' ] = '_parent' ; } else { data [ 'actionParameters[returnTarget]' ] = 'iframeportlet' ; } var baseURI = this . location . href ; if ( baseURI . indexOf ( "?" ) > - 1 ) { baseURI = baseURI . substring ( 0 , baseURI . indexOf ( "?" ) ) ; } data [ 'actionParameters[returnLocation]' ] = encodeURIComponent ( baseURI ) ; data [ 'actionParameters[renderedInDialog]' ] = true ; data [ 'actionParameters[returnByScript]' ] = lookupReturnByScript ; data [ 'actionParameters[methodToCall]' ] = "start" ; data [ 'actionParameters[flow]' ] = "start" ; data [ 'actionParameters[returnFormKey]' ] = jQuery ( "#" + kradVariables . FORM_INFO_ID ) . children ( "input[name='formKey']" ) . val ( ) ; if ( dialogId ) { data [ 'actionParameters[dialogId]' ] = dialogId ; } var lookupParameters = data [ 'actionParameters[lookupParameters]' ] ; if ( lookupParameters !== "" && typeof lookupParameters !== "undefined" ) { var params = lookupParameters . split ( "," ) ; for ( var i = 0 ; i < params . length ; i ++ ) { var param = params [ i ] ; var lookupField = param . substring ( param . indexOf ( ":" ) + 1 ) ; var lookupFieldName = param . substring ( 0 , param . indexOf ( ":" ) ) ; var lookupValue = "" ; if ( jQuery ( "[name='" + escapeName ( lookupFieldName ) + "'][type='radio']" ) . length > 0 ) { lookupValue = jQuery ( "[name='" + escapeName ( lookupFieldName ) + "']:radio:checked" ) . val ( ) ; } else { lookupValue = jQuery ( "[name='" + escapeName ( lookupFieldName ) + "']" ) . val ( ) ; } if ( lookupField !== "" && typeof lookupField !== "undefined" && lookupValue !== "" && typeof lookupValue !== "undefined" ) { data [ 'actionParameters[lookupCriteria[&quot;' + lookupField + '&quot;]]' ] = lookupValue ; } } } var lookupUrl = data [ 'actionParameters[baseLookupUrl]' ] + "?" ; for ( var key in data ) { if ( key . indexOf ( "actionParameters" ) !== - 1 ) { var parameterName = key . replace ( "actionParameters[" , "" ) . replace ( "]" , "" ) . replace ( new RegExp ( "&quot;" , 'g' ) , "'" ) ; lookupUrl += parameterName + "=" + data [ key ] + "&" ; } } lookupUrl = lookupUrl . substring ( 0 , lookupUrl . length - 1 ) ; lookupUrl = lookupUrl . replace ( / &amp; / g , '&' ) ; openIframeDialog ( lookupUrl , lookupDialogId ) ; } else { data [ 'actionParameters[renderedInDialog]' ] = 'true' ; data [ 'actionParameters[returnTarget]' ] = '_self' ; var flow = jQuery ( "input[name='" + kradVariables . FLOW_KEY + "']" ) . val ( ) ; if ( flow !== "" ) { data [ 'actionParameters[flow]' ] = flow ; } nonAjaxSubmitForm ( data [ 'methodToCall' ] , data ) ; } } ) ; }
Submits the form based on the quickfinder action identified by the given id and display the result content in
 a dialog using a modal.
Submits the form based on the quickfinder action identified by the given id and display the result content in a dialog using a modal .
// Check if this is not called within a lightbox
 // Trim the remaining ampersand
 // add parameters for lightbox and do standard submit
