Adobe Interactive Forms. Part 23. How to Hide the Fields and Acquired Space Dynamically using JavaScript in Adobe Form

PREQ: Should be aware of basics of Adobe Form.

Transaction code: SFP

Enter the interface name and click on create.

Enter the description and save it.

Create the custom importing parameters variables by clicking the import button on the left side and click on create button on right side and save and activate it. We have declared three parameters of same type of CHAR20.

Now go back to the main screen of SFP and choose the option Form and create it by adding the interface which we had created previously.

On the left side expand import section of interface and drag and drop all the importing variables IV_NAME1, IV_NAME2 and IV_NAME3 to context.

Let’s create the Layout of form which is available next to Context button.

Switch to design view and click on Hierarchy part. Select the content area of a form and click on object (right side) after that click on Subform and choose content type: Flowed

Now here we will design the form using Subform and wrap every object like text fields, text box, Buttons and tables etc. in it.

Here we will create 4 Subforms in content area.

Now select the Subform and inert the text fields and rename the default name of Text Fields to:

Name1, Name2 and Name3

NoteRenaming is not necessary we are just doing for better understanding. 

Do the binding of all three text fields from the importing parameter variables (IV_NAME1, IV_NAME2 and IV_NAME3) by clicking on the the binding > Data Binding > choose the field

After the we will hide the field Name2 of subform2 using JavaScript. Select the subform2 and go to Palettes > Script Editor

You will get the below screen

Choose the event Initialize and language JavaScript and write the below code.

if( this.Name2.rawValue == null )

{              this.presence = ‘hidden’

}

We are hiding the field Name2 if its empty.

Always use the same field name (Name2) in script which is defined in the subform and it’s a case sensitive also otherwise it won’t work.

NoteWe are writing JavaScript code on top of subform2 not on the field

Check save and activate it.

Let’s test our form.

Case 1: Press F8 and pass all the importing values.

Press F8 and press on print preview.

Here script won’t hide Name2 as have passed the value in IV_NAME2. 

Case 2:  IV_NAME2 =   ‘ ‘.

Press F8 and don’t pass the value in IV_NAME2.

This time JavaScript code gets executed to hide the field Name2 and removed the space also.

If you see below fields has shifted to up and adjusted the space automatically. This is only possible if you wrap the fields in Subform. 

Hope you were able to get a fair idea about this interesting topic. If you have any doubts, queries or suggestions for us, please put your comments below. I will be happy to respond you.

YOU MAY LIKE THIS

SAP ABAP Checkpoint Group – Chase the Mysterious SAP Issues with a Smile

Best Practices for SAP ABAP Development: A Comprehensive Guide

4 Useful Tips on ABAP and ABAP on HANA

₹25,000.00

SAP SD S4 HANA

SAP SD (Sales and Distribution) is a module in the SAP ERP (Enterprise Resource Planning) system that handles all aspects of sales and distribution processes. S4 HANA is the latest version of SAP’s ERP suite, built on the SAP HANA in-memory database platform. It provides real-time data processing capabilities, improved…
₹25,000.00

SAP HR HCM

SAP Human Capital Management (SAP HCM)  is an important module in SAP. It is also known as SAP Human Resource Management System (SAP HRMS) or SAP Human Resource (HR). SAP HR software allows you to automate record-keeping processes. It is an ideal framework for the HR department to take advantage…
₹25,000.00

Salesforce Administrator Training

I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.
₹25,000.00

Salesforce Developer Training

Salesforce Developer Training Overview Salesforce Developer training advances your skills and knowledge in building custom applications on the Salesforce platform using the programming capabilities of Apex code and the Visualforce UI framework. It covers all the fundamentals of application development through real-time projects and utilizes cases to help you clear…
₹25,000.00

SAP EWM

SAP EWM stands for Extended Warehouse Management. It is a best-of-breed WMS Warehouse Management System product offered by SAP. It was first released in 2007 as a part of SAP SCM meaning Supply Chain Management suite, but in subsequent releases, it was offered as a stand-alone product. The latest version…
₹25,000.00

Oracle PL-SQL Training Program

Oracle PL-SQL is actually the number one database. The demand in market is growing equally with the value of the database. It has become necessary for the Oracle PL-SQL certification to get the right job. eLearning Solutions is one of the renowned institutes for Oracle PL-SQL in Pune. We believe…
₹25,000.00

Pega Training Courses in Pune- Get Certified Now

Course details for Pega Training in Pune Elearning solution is the best PEGA training institute in Pune. PEGA is one of the Business Process Management tool (BPM), its development is based on Java and OOP concepts. The PAGA technology is mainly used to improve business purposes and cost reduction. PEGA…
₹27,000.00

SAP PP (Production Planning) Training Institute

SAP PP Training Institute in Pune SAP PP training (Production Planning) is one of the largest functional modules in SAP. This module mainly deals with the production process like capacity planning, Master production scheduling, Material requirement planning shop floor, etc. The PP module of SAP takes care of the Master…
X
WhatsApp WhatsApp us
Call Now Button