Discussion

Refresh Section using Hidden Property. and call activity when refreshing Section

Hi,

I'm try to refresh a Section using Hidden Property.

<input type="hidden" name="test" ONCHANGE= "handleClientEvent('SERVER', 'TestActivity','', '-1', event)" value="true" id="test" mode="NORMAL">

Call this property in onchange event. Using java script function

function test(){

document.getElementById('test').fireEvent('onchange', event);

}

this work fine. and call "TestActivity" while refreshing section.

but i want to pass parameters to this activity. and parameters are define in another function.

Function b()

{

 Var testParameters= "Test";

}

 how i pass "testParameters" variable to "TestActivity"? is it possible?

 

Note : Input tag was created in JSP page. All the functions are in same page.

 

 

 

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

November 21, 2013 - 6:11am

Hi Thushan,

 

There are multiple ways that we can do a section using in Pega. The HandleClientEvent function is actually Pega use to bind the onchange event when we refer onchange event for any supported HTML element in a layout.

To Answer your Question. If you use a property and use Fire Event like explain above and if you intended to use HandleClientEvent function directly in the onchange of the input I think it is not possible to pass dynamic parameters than hard coding it. [Please anyone who read this found that what I told was wrong please correct me.]

Best is to call a function in onchange and inside the function call the handleclientevent and construct all your parameters and pass it inside the function.

<input type="hidden" name="test" ONCHANGE= "callFunction()" value="true" id="test" mode="NORMAL">

<script>

function callFunction(){

 var params = "&pzPrimaryPageName=pyWorkPage&val=10&name=suresh";

handleClientEvent('SERVER', 'TestActivity',params, '-1', event)

}

</script>

The above way we will have to use a separate property and a function and use in where we need it too much work. (Include hidden property in required section/ and calling the onchange fire event in another place)

But

 

I think the best way for you to achieve this is to use the  below function. Using this we do not need to use a hidden property. Directly we can specify the section name. So better create a control in common level and parameterized the section name and whatever you want. So we can reuse the control later.

[  Please explore this function more to understand the parameters completely.  It is in pega_ui_doc js]

pega.u.d.reloadSection(Section Element , 'ActivityName', 'Activity Parametres', bFormSubmit, bSectionSubmit, pageListIndex, bDoNotSetAll,event);

Ex;

var params = "&pzPrimaryPageName=pyWorkPage&val=10&name=suresh";  // get primary/base page dynamically best not to hard code it. passing value to pzPrimaryPageName is very important when you are working in portals so rule not find exception and other java exceptions will not occur due to missing of the primary page of the activity.

pega.u.d.relaodSection(pega.u.d.getSectionByName("Section Name","",""),"TestActivity",params,false,true,'-1',false);

here  pega.u.d.getSectionByName("Section Name","","") function is used to get the section element.

 --- OR-----

Use below function  (But when you use this function you cannot call an activity [still this function wraps the reloadSection function inside it])

pega.u.d.refreshSection("Secion Name", 'usingPage' , 'Container' );   // use ‘usingpage’ when the section to be refreshed is include to the current screen using a different page.

 

 

 

September 2, 2014 - 9:17am

An excellent post suresh

September 2, 2014 - 7:14pm

Thanks Suresh! I could use this to remove my hidden property as well.

April 10, 2015 - 7:20pm

Thanks. Great Help

January 27, 2016 - 4:31am

can anyone give me exact format of the function ?