Hi all,
Recently i had a requirement to hide a field conditionally based on the value of another field. This could be done using browser script but since we are using Open UI so we achieved it using
Physical Renderer file(PR). The arrpoach is preety simple.
1. Need to Identify the field depending on which to hide the other field or Hide same field.
2. Write the logic in PR file to hide the field.
3. Register the custom PR against the applet in Mainfest Administration.
The exact logic is :
Result
Field Active is hidden if the value is N, This can be modified for other requirement as well we just need to identify the correct element /field to hide, using inspect element.
PR file looks Like
Recently i had a requirement to hide a field conditionally based on the value of another field. This could be done using browser script but since we are using Open UI so we achieved it using
Physical Renderer file(PR). The arrpoach is preety simple.
1. Need to Identify the field depending on which to hide the other field or Hide same field.
2. Write the logic in PR file to hide the field.
3. Register the custom PR against the applet in Mainfest Administration.
The exact logic is :
Result
Field Active is hidden if the value is N, This can be modified for other requirement as well we just need to identify the correct element /field to hide, using inspect element.
PR file looks Like
if (typeof(SiebelAppFacade.LOYHideFieldPR) === "undefined") { SiebelJS.Namespace("SiebelAppFacade.LOYHideFieldPR"); define("siebel/custom/LOYHideFieldPR", ["siebel/phyrenderer"], function () { SiebelAppFacade.LOYHideFieldPR = (function () { function LOYHideFieldPR( pm ) { /* Be a good citizen. Let Superclass constructor function gets executed first */ SiebelAppFacade.LOYHideFieldPR.superclass.constructor.call( this, pm ); /* Static List of Control Identifier which will be displayed in Carousel; */ } SiebelJS.Extend( LOYHideFieldPR, SiebelAppFacade.PhysicalRenderer ); LOYHideFieldPR.prototype.ShowUI = function() { SiebelAppFacade.LOYHideFieldPR.superclass.ShowUI.call( this ); var pm = this.GetPM(); var controls = this.GetPM().Get("GetControls"); var cntrl = controls[ "ActiveFlag" ]; var ActiveFlg = pm.ExecuteMethod( "GetFieldValue", cntrl ); // alert(ActiveFlg); Test to check if value is retrieved or not if(ActiveFlg == "N") { $('[aria-labelledby = "ActiveFlag_Label"]').hide(); $('#ActiveFlag_Label').parent().hide(); } }; return LOYHideFieldPR ; }()); return "SiebelAppFacade.LOYHideFieldPR"; }); } |
Hope this was helpful..
Hi,
ReplyDeleteNeed to Disable a button from an applet using Jquery in PR script from UI only. How can this be achieved.
Hello Lakshmi,
ReplyDeleteyou can use either
$('#Button').attr('disabled','disabled'); //jquery
here #Button is the id of button. or you can set visibility to hidden for the given button ,
$("#Button").css("visibility", "hidden");//css
Regards,
Rahul
Hi, we have a requirement almost the same as this but the condition to hide a field will depend on the value of another field and not the field to hide. How to achieve this?
ReplyDeleteMany thanks for your help.
Hi, in addition to my comment the field to hide is a picklist field while the field to check for condition is a calc field. Is this possible?
DeleteHi, When value is changed from N to Y, unless page is refreshed show/hide is not coming into picture. What is the solution on that? How can we refresh browser cache on change of field value.
ReplyDeleteHello Van, you need to register field change event and call the code to hide control in that function.
ReplyDeleteSomething like
this.GetPM().AttachPMBinding(“FieldChange”,onFieldChange )
This code will be fired each time field change occurs
What is an outstanding post! “I’ll be back” (to read more of your content). Thanks for the nudge! 안전놀이터 순위
ReplyDelete