cancel
Showing results for 
Search instead for 
Did you mean: 

is it possible to hide an object on a masterpage dynamically?

Former Member
0 Kudos

hello,

is it possible to hide an object on a masterpage dynamically?

I tried to define a formula in the script editor with FormCalc, but it doesn't work. I made a similiar definition within the content area and this definition is working.

It is a HCM form and the following formular is defined in the initialization event of the object:

if( Exists($record.DIM_EMPLOYEE.DATA[*].FIRE_DATE[0]) == 0 ) then

$.presence = "hidden"

endif

Can anybody help me , please?

Regards,

Tanja

Accepted Solutions (0)

Answers (8)

Answers (8)

OttoGold
Active Contributor
0 Kudos

By the way: do you know that CTRL+V function of LCD to fwrite the qualified name for you? Otto

chintan_virani
Active Contributor
0 Kudos

You meant to say "Ctrl + Space Bar" for auto completion of field names ?

chintan_virani
Active Contributor
0 Kudos

Well YES it is possible to hide an object of master page. Couple of things you can try:-

1. Use quotes around zero. i.e.

if( Exists($record.DIM_EMPLOYEE.DATA[*].FIRE_DATE[0]) == "0" ) then

2. Use fully qualified names for the object of Master Page and place the event in form:ready event of the subform instead of master page.

Also I tried a small example and it worked. Sample Hierarchy is shown below

form1
|-- Master Pages
     |-- Page1
          |-- Content Area
          |-- TextField1
|-- (untitled subform) (page1)
     |-- TextField2

JS code on the exit event of TextField2

form1.#subform[0].TextField2::exit - (JavaScript, client)

if(this.rawValue == "1")
{
	form1.pageSet.Page1.TextField1.presence = "hidden";
}

OttoGold
Active Contributor
0 Kudos
OttoGold
Active Contributor
0 Kudos

Works only on client and JavaScript. Otto

Former Member
0 Kudos

Hi,

the a-l-e-r-t statement doesn't work within my form. For testing I put

a-l-e-r-t("TEST") // without the -

if( Exists($record.DIM_EMPLOYEE.DATA[*].FIRE_DATE[0]) == 0 ) then

$.presence = "hidden"

endif

to my script. The script runs with FormCalc and on the server.

I also tried the "javascript version ":

a-l-e-r-t("TEST"); // without the -

this.presence = "hidden";

But it doesn't work.

Probably it is an syntax problem. I am a beginner in scripting language.

thanks,

Tanja

OttoGold
Active Contributor
0 Kudos

This is easy. Use app.a-l-e-r-t("meesage") or (variable) to get a debug popup. Note I cannot write that al-ert because it disturbs this pages logic, so please omit the "-i" mark. Hope this helps, Otto

Former Member
0 Kudos

Hello,

thanks for the fast reply.

If I only define the hidden statement, it works. How can I debug the form, to get the value or the format of the value at the runtime?

I tried a lot of format variations to compare with the fire_date.

I use a copy of the SAP Standard SAP_PAYSLIP_DE_P of HCM forms.

Regards,

Tanja

OttoGold
Active Contributor
0 Kudos

Hello,

in fact I don´t know if that is possible, but it should be pretty easy to try.

Place JS like: this.presence = "hidden"; on the master page element you want to hide, use event like initialization for example. This only tests if there was an error in your coding.

I am looking forward to the result of this test or anybody else saying if that is possible.

Regards, Otto