Sometimes it can be interesting to set or modify styles dynamically on a field, for example to hide it or to change some text colour.

PeopleSoft does not allow to change styles set in Application Designer because they are static, so you can’t change them from PeopleCode, but if we add them from PeopleCode we can change them later dynamically. For example, if you want to hide a field you can write this code:

MyRecord.MyField.AddFFClass(“psc_hidden”);

Later, if you want to unhide the field there is no method to remove the “psc_hidden” style, but there is a method to replace it. This is the code to unhide the field:

MyRecord.MyField.ReplaceFFClass(“psc_hidden”, “”);

These methods work fine with PeopleSoft standard styles and also with our custom stylesheets. For example, if we have defined a style to create red text in our customized stylesheet:

.red_text {

 color:rgb(255,0,0);

}

We add the stylesheet in our page:

AddStyleSheet(StyleSheet.MY_STYLESHEET);

When we need it, we can make a text dynamically change to red:

MyRecord.MyField.AddFFClass(“red_text”);

Later, if we need to remove the style in another peoplecode event we can change the text back to its original color:

MyRecord.MyField.ReplaceFFClass(“red_text”,””);

Last but no least:

Check on this link how to use the AddFFClass method to update the value of the FreeFormStyleName property.

Check on this link how to use the ReplaceFFClass method to update the value of the FreeFormStyleName property.

Related articles:

PeopleSoft Fluid Timesheet released in HCM PUM Image 25

Search Enhancements: PeopleSoft Applicaction Designer

PeopleSoft Tips: Custom buttons actions for Scroll Areas

Client Stories. PeopleSoft Fluid User Interface: Making a Great User Experience

Iván Saiz
Latest posts by Iván Saiz (see all)