cancel
Showing results for 
Search instead for 
Did you mean: 

hide dynamically SUBFOMRS

Former Member
0 Kudos

Hi Friends,

I have three subforms containing three tables.

For example

table1

table2

table3

If one of the table is empty, then i want to hide dynamically that subform.

So i want to write some script on the subfomrs to check if the content is present in the table or not.

If there si no data then i want to hide that entire subform.

Can you please help me in writing the script to hide the subform based on the data in the table.

Sample code is really helpfil.

Thanks in advance.

Regards,

Sasidhar

Accepted Solutions (0)

Answers (1)

Answers (1)

bryan_cain
Contributor
0 Kudos

In the initialize event of the subform, you could put a script like the one below. Replace table with the name of your table and field with the name of a field in your table.



if ($.table[0].field.value.#text == "") then
	$.presence	= "hidden"
else
	$.presence	= "visible"
endif

This should check that a field in the first row of the table has a value.

Former Member
0 Kudos

Hi,

I used the same code in the event. Form Initialize and select the java script, but its still displaying me the subform.

Can you please help me.

Regards,

Sasidhar

bryan_cain
Contributor
0 Kudos

The code I posted was FormCalc, not JS.

Former Member
0 Kudos

Hi,

My Hierarchy.

Subform

subform1

subform2.

The subform2 contains the table as well as a field.

subform2

v_tect

i_table1.

If the table i_table1 does not contian any entries i want to hide the entire subform2 including the table as well as the field v_tect.

So i kept the code that you provided in the initialize event of the subform2.

Can you please tel me if iam doing something wrong.

Thanks in advance

regards,

Sasidhar

bryan_cain
Contributor
0 Kudos

Please post the actual code you put in the initialize event, and we'll go from there.

Former Member
0 Kudos

Hi,

subform2

v_tect

i_table1.

I kept the following code in the subform2.(TDLINE is the field name in the table i_table1)

Form clac is the language i selected.

if ($.i_table1[0].TDLINE.value.#text == "") then

$.presence = "hidden"

else

$.presence = "visible"

endif

Regards,

Sasidhar

Edited by: sasidhar yalamanchili on Mar 20, 2009 7:10 PM

bryan_cain
Contributor
0 Kudos

Hm. I would have expected that to work.

Try moving the [0] to after TDLINE rather than after i_table.

so:

i_table.TDLINE[0]...

Former Member
0 Kudos

THE HIERARCHYY MAY BE DIFFERENT in my case

I_TABLE

DATA

TDNAME

TDLINE.

Is this causing any problem.

Regards,

Sasidhar

bryan_cain
Contributor
0 Kudos

Use the autocomplete function to of the script editor to build the correct expression.

Type in $. (be sure to include the period) and it should give you a list of options. Just keep moving down your hierarchy to get to the element you want.

So type $.

In the list, you should see DATA as one of the options. Choose it.

Now you have $.DATA

Type another .

Chose TDNAME

Etc...

Former Member
0 Kudos

Hi,

Thanks a lot,

U made my weekend relaxing.

Regards,

Sasidhar

bryan_cain
Contributor
0 Kudos

Glad to hear it.

Don't forget to close the question ( and the points )