Saturday, February 21, 2015

Change Apply Button of dashboard prompt for particular dashboard page

Hi All, 

Some time you will get requirement, to change the apply button name for particular dashboard page. As per my knowledge we cannot change the apply button name for particular dashboard page.

Solution 
1--> Hide the prompt apply button
2--> Create the separate button with help of HTML and Java Program. Give the name as per your requirement. Here in my example i have give "Apply Rakesh Patil"

Steps
1--Edit Dashboard, Go to Dashboard Properties,
In Prompts Apply Buttons - Select hide all apply buttons
In Prompts Reset Button – Select Hide all apply buttons
Click on ok.




















2--Drag Text object – Go to Properties, and select check mark  in Contain HTML Markup and add below code.


<DIV CLASS = "XUIPromptEntry minibuttonOn" align="center">
<input class="button" type = "button" value = "Apply - Rakesh Patil" onclick='javascript:
try
{
var x = 0;
var aElm=PromptManager.getPromptManager().getAllPromptCollectionJSON();
for(var i = 0; i < aElm.length;i ++ )
            {
            for(var j = 0; j < aElm[i].promptSteps[0].prompts.length;j ++ )
                        {
                        var promptid = aElm[i].promptSteps[0].prompts[j].promptStreamID;
                        var g = null;
                        var h = PromptManager.getPromptManager().getPromptCollectionInfoWithViewID(aElm[i].viewStatePath);
                        if(h)
                                    {
                                    try
                                                {
                                                var b = h.getAllPromptExprsArray();
                                                if( ! h.verifyPromptValuesAndDisplayError(b))
                                                            {
                                                            return;
                                                            }
                                                g = PromptManager.buildPromptExprGivenExpr("", b);
                                                }
                                    catch(f)
                                                {
                                                alert(f);
                                                return;
                                                }
                                    }
                        }
            x++;
            }
x--;
PromptManager.submitPrompt(aElm[x].viewStatePath, true,"PromptFinish", g)
}
catch(e) {alert("Apply ALL Button Exception" + e.description);}' ></input>
<input class="button" type = "button"  value = "Reset" ONCLICK = 'return PersonalizationEditor.removeDefaultSelection(false)' > </input>
<div/>

Let me know if you have any questions.

Output :






Thanks and Regards 
Rp - rakeshpatil002@gmail.com


1 comment:

  1. Hi Rakesh,
    You've passed default values in this example. What do we need to do if we want to pass our own custom values?

    Thanks.

    ReplyDelete