cancel
Showing results for 
Search instead for 
Did you mean: 

different layout types

Former Member
0 Kudos

Dear,

I have the following problem: I'm creating an adobe form for a customer. There is a Badi created which sends data to my form in order to test it. There are levels in the form regarding titlelayouts (1.Title, 1.1 Title Description, 1.1.1 Description,...). The customer wants a different layout for each number.

I've created 3 layouts (by modifying the standard SAP template) and I've wrote the following FormCalc script to make the form take the right layout:

if ($.parent.NUMBERING.rawValue.length == 1) then

$.layout1.presence = visible

$.layout2.presence = hidden

$.layout3.presence = hidden

endif

if (($.parent.NUMBERING.rawValue.length == 3) or ($.parent.NUMBERING.rawValue.length == 4)) then

$.layout2.presence = visible

$.layout1.presence = hidden

$.layout3.presence = hidden

endif

if ($.parent.NUMBERING.rawValue.length == 5) or ($.parent.NUMBERING.rawValue.length == 6)) then

$.layout3.presence = visible

$.layout1.presence = hidden

$.layout2.presence = hidden

endif

The NUMBERING field is a column in the Badi that contains the values 1, 1.1, 1.1.1, 1.1.2,...

This code however doesn't seem to work. Can anybody give some advice on what is wrong with this code?

Like I said that script is written in FormCalc and runs on client and server side.

Thanks in advance for your help.

Kind regards,

ToMMy

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Tommy,

I am not a fan of FormCalc but if you are intrested in Javascript which can be written on the topnode's formready event find the below code .

var numberingField = <your fieldpath>.rawValue;

layout1.presence = "hidden";

layout2.presence = "hidden";

layout3.presence = "hidden";

if (numberingField.length == 1) {

layout1.presence = "visible";

} else if (numberingField.length == 3 || numberingField.length == 5){

layout2.presence = "visible";

}else if (numberingField.length == 5 || numberingField.length == 6) {

layout3.presence = "visible";

}

This is just an assumption may be you need to put the hidden visible values in quotes...in your code ...?

Cheers,

Sai

Former Member
0 Kudos

Sai,

I've tried with and without the quotes but that is not the issue because it doesn't work in both cases.

However when I call a MessageBox to show the rawValue of the field in the NUMBERING table it gives this information but it simply doesn't display the correct layout..

I've tried your javaScript in the top subform of the layout subforms and it doesn't seem to be working

Do you have other suggestions?

Oh yea: I got this weird MessageBox everytime I try to test my form. It gives a message saying "Mandatory". Do you know how I can make this messagebox dissappear?

Thanks in advance for your help.

Kind regards,

Tom

Former Member
0 Kudos

Hi Trogo,

On which event are you trying to run the script.

Just place the code in both form & layout ready and test it, try to debug line by line instead.

for the validation message box check if "mandatoryMessage" object is being used anywhere in the form.

to check this just select element tree's top nod, and select events with script in the script editor, search it there.

Cheers,

Sai

Former Member
0 Kudos

Hi Sai,

I've putted the JavaScript code in the following methods:

-


data.#subform[0].Body.T_ELEMENTS.DATA::ready:form - (JavaScript, both) -


-


data.#subform[0].Body.T_ELEMENTS.DATA::ready:layout - (JavaScript, both) -


I found the issue when I clicked on preview. It said that a method was called that doesn't exist but apparently it turned the code from JavaScript to FormCalc.. Strange SAP 😛

But the layout still doesn't work.

Kr,

Tom

Former Member
0 Kudos

Hi Tom,

There seems to be problem with the form properties you have.

Is this the form you started or you are modifying an existing form which was done by someone else.

Is it possible to you send me the form to investigate.

Anyhow i will quickly build an example one for you to send so you can refer the properties and the scripts I do.

Can you send me a test mail to my ID so i can reply to that.

Cheers,

Sai

Former Member
0 Kudos

Hi Tom,

Find the file from the below link.

Check both the script and form properties.

Cheers,

Sai

Former Member
0 Kudos

Sai,

I don't see the link for your test form. Can you check if it is there?

Thanks for your help. I hope this solves the issue.

Former Member