cancel
Showing results for 
Search instead for 
Did you mean: 

Adobe Form - How to set a condition for a Subform

Former Member
0 Kudos

Hi All

I am new in Adobe Form and learing it - (I had some knowledges of SmartForm) - One of the requirement I have to do is to print out a different layout (subform) according to a value of a flag.

In Smartform, I can draw diffrent layouts and put a condition on each layout so each one can be printed accroding to the flag value.

In Adobe Form, the subform (or any other object) cannot be conditional set - I don't know how to do it - Could comeone please show me how - I reward points for any reply - Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello.

Thanks for yours answers.

But I don't manage to make "ok" the solutions given by Mark Huisman and Liem Van Duong...

I don't understand why.

I put your solution on the subform "Article" - initialize - JavaScript - client.

Can you help me again ?

I re-explain :

I have :

1/ Subform : Texte1

2/ SubForm : Article

- Table : Table1

-- Rang : Rangée1

--- subform : SubForm2

-

-


fields : LIB_ARTICLE

-

-


fields : NUM_ARTICLE

3/ SubForm : Texte2

I want :

- print the subform "Article" if i have some data in the table,

- doesn't print the subform "Article" if i have no data in the table (= or if all of the fields of the table are initial) and use "hidden" for ADOBE syntaxe (= no space on the Form => the texte2 are just in lower part of the texte1 when I print)

Céline.

Former Member
0 Kudos

Hello.

I have a answer :

if (this.isNull) then {

this.presence="Hidden"; }

It's ok in JavaScript in the subForm "Article".

Thanks all for yours answers.

Bye.

Céline.

Former Member
0 Kudos

Hi,

You cna write your code in either java script or form calc.

u cna right in the initalization.

if (condition) satisfied

subform.presence = hidden.

endif.

Former Member
0 Kudos

Hi.

Sorry for my english... but how you write the condition when you have a table in a subForm ?

I explain :

I have a SubForm "Article" with a table "Table1", with Raw "Rangée1" who contain another SubForm "SubFrom2" with fields "num_article, lib_article".

I want to write :

If ( all the fields of the table are initial ) then

Article.presence = hidden

endif.

or

If ( the table is initial ) then

Article.presence = hidden

endif.

But, how i write the condition ?

If ( article.table1 = Null ) then ... ?

If ( article.table1.Rangée1.SubForm2.lib_article.rawValue = " " ) then... ?

...

Best Regards.

Former Member
0 Kudos

That depends on what you want to check, for example :

 
 if (hasValue($)) then
  // do some actions
endif

or

 
 if ($ != "") then
  // do some actions
endif

This checks whether there is input in the specific field.

 
 if ($ != null) then
  // do some actions
endif

While this code checks whether the there is an active instance of the object present.

You can even combine these two by piping the if statement.

 
 if (hasValue($) || $ != null) then
  // do some actions
endif

Good luck!

Edited by: Mark Huisman on Jun 12, 2008 4:58 PM

Typo

Former Member
0 Kudos

You are excused with your English - and you must excuse mine , too

Your questions:

But, how i write the condition ?

1- If ( article.table1 = Null ) then ... ?

2- If ( article.table1.Rangée1.SubForm2.lib_article.rawValue = " " ) then... ?

Try this:

1- // Locate the table node from to down

var tNodes = xfa.resolveNodes("Table1[*]");

If (tNodes.value == NULL) {

tNodes.presence = "Hidden" }

or

2- // locate the varable fields and loop thru to check if they are all empty

var fNodes_1 = xfa.resolveNodes("article.table1.Rangée1[*].SubForm2.num_article");

var fNodes_2 = xfa.resolveNodes("article.table1.Rangée1[*].SubForm2.lib_article");

var fNodesLength = fNodes_2.length;

var table_empty = "Y";

for (var fNodeCount = 0; fNodeCount < fNodesLength; fNodeCount++) {

If (fNodes1.item(fNodeCount).rawValue <> " ") or

(fNodes2.item(fNodeCount).rawValue <> " ") {

table_empty = "N";

}

// Now find the table node and hide if if necc

var tNodes = xfa.resolveNodes("Table1[*]");

If table_empty = "Y" {

tNodes.presence = "Hidden" }

You must place those codes at the Subform Article level in Javascript mode

Good Luck

Edited by: Liem Van Duong on Jun 13, 2008 2:45 AM

Edited by: Liem Van Duong on Jun 13, 2008 2:46 AM