cancel
Showing results for 
Search instead for 
Did you mean: 

Making fields visible or invisible on the form Dynamically.

Sarang_Akhare
Explorer
0 Kudos

Hi All,

In my case I have a drop down field having various values on ADOBE form.According to those values the remaining fields in the form should get visible or invisible accordingly. Can you please help me out in javascripting required in this case?

I have tried scripting as given below but it is not working. I request you to please tell me whats the problem in this and what needs to be done to achieve this.

For Example in case if i select "03 - Transfer" in the dropdown field named OPTION then I want to make New Personal Sub area field as visible and editable on the form so that user can enter data into it ELSE it should not be visible on the form.For this the scripting i wrote in javascript in the event CALCULATE for this field is as follows.

if($record.OPTION.DATA.FIELD == "03 - Transfer")

then

this.access == "open"

else

this.presence = "invisible"

endif

But this is not working when I check the form on portal.Please let me know what I need to do inorder to achieve this functionality.

I have wrote the similar code in CALCULATE event for each field on the form but the form not working according to requirement.

Please provide me with information how to decide the event in which we should write the script?

Thanks in Advance.

Sarang

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member205363
Contributor
0 Kudos

Hi,

Try like this, take dropdown box and other fields on your form.

1) Create an attribute in the context with the type com.sap.ide.webdynpro.uielementdefinitions.Visibility. Map this attribute to form fields visibile property.

2) Create onSelect Action of Dropdown and write the code in that method to visibile the fields based on condition.

3) Set the fields visibility Visibility.NONE in the wdInit() method and in the Action method set visible Visibility.Visible

Regards,

Lakshmi Prasad.

Sarang_Akhare
Explorer
0 Kudos

Hi Lakshmi,

Thanks for the reply.I am working on PCR - presonal change Requests.Uptil now I have not done any coding on web dynpro side.i have only coded in ABAP in the relevant function modules.

Can you please explain what exactly to code or a sample code inorder to achieve this functionality.That will really be helpful.

Regards,

Sarang

Former Member
0 Kudos

Hi Sarang

Please go through this link

http://help.sap.com/saphelp_nw70/helpdata/en/42/ed3ce7f8593eebe10000000a1553f7/frameset.htm

Please go through this link

Regards

Ruturaj

Former Member
0 Kudos

hi!

i think it can be done without any scripting in nwds.refere the following tutorial on visible/invisible (in the tutorial it is refered to as show/hide):

http://saptechnical.com/Tutorials/WebDynproJava/EnableHide/page1.htm