Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Form design Adobe Livecycle Designer ES 8.1

Avatar

Former Community Member
Hi,



I have created a Form in Adobe Livecycle Designer ES 8.1.



The form contains 6 pages.I want to display the particular page by clicking the button. I have designed those buttons in MasterPage like header.



I am able to display the particular page. One condition i need to display 1 & 2 page at a time .I am not able display this scenario.



Please help me.
12 Replies

Avatar

Level 10
What the code behind your navigation button? I just need to understand how you implemented it.



Jasmin

Avatar

Former Community Member
form1.#variables[0].controller - (JavaScript, client)

var im;

var pageName;

var currentPageNum;

var dataStore;

var logLevel;

var history;



/*

*

* ADOBE SYSTEMS INCORPORATED

* Copyright 2005 Adobe Systems Incorporated

* All Rights Reserved

*

* NOTICE: Adobe permits you to use, modify, and distribute

* this file in accordance with the terms of the Adobe license

* agreement accompanying it. If you have received this file

* from a source other than Adobe, then your use, modification,

* or distribution of it requires the prior written permission

* of Adobe.

*

* MVC Model 2 XFA Sample Implementation

*

* Created on Feb 22, 2005

*

* Author Herve Dupriez

* Email hdupriez@adobe.com

* Version 1.0

*

*/



/*

*

* Main Action Controller

*

* For the simplicity of this controller, actions are coded within this main function.

* For more complex frameworks, this function could simply act as a switch to other functions.

*

*/

function executeAction( action )

{



debugLog("executeAction " + action );



var pnum = getPageNum(action);



debugLog("history size " + history.length );



if ( action == "back" )

{

if ( history.length > 1 )

{

// Restore previous page

debugLog("back to page " + history[history.length - 2] );

im[currentPageNum].removeInstance(0);

currentPageNum = history[history.length - 2];

loadPage( currentPageNum );

im[currentPageNum].addInstance();

}

else

{

forward(1);

}

}

else if ( action == "first" )

{

forward(1);

}

else if ( action == "last" )

{

forward(9);

}

else if ( action == "previous" )

{

var prev = currentPageNum-1;

if ( prev > 0 && prev < pageName.length )

forward(prev);

}

else if ( action == "next" )

{

var next = currentPageNum+1;

if ( next > 0 && next < pageName.length -2 )

forward(next);

}

else if ( pnum == -1 )

{

showErrorPage(404, "Page Not Found");

}

else

forward(pnum);

}



/*

*

* Initialization of the controller

*

* For debugging purposes increase the logLevel variable below

*

*/

function init()

{

console.println("init");



// Init log level

// 0: error

// 1: warning

// 2: info

// 3: debug

// 4: trace

logLevel = 0;



// Initialize instance managers and page names

if ( im == null )

{

scanPages();

}



// Initialize "page number"

if ( currentPageNum == null )

{

currentPageNum = 0;

var dataNodes = xfa.data.form1.nodes;

debugLog( xfa.data.form1.saveXML() );

if ( dataNodes != null )

{

var intNumElements = dataNodes.length;



for(var j=0; j < intNumElements; j++)

{

var currentElement = dataNodes.item(j);

debugLog("listNodes found " + currentElement.name );

if ( currentElement.name.substr(0,5) == "page_" ) {

var action = currentElement.name.substr(5) ;

setCurrentPage( getPageNum( action ) );

break;

}

}

}



/*

* Show last page viewed when document was saved

* or the Welcome Page if document opened for the first time

*

*/

if ( currentPageNum == 0 )

im[currentPageNum].addInstance();

}



// Initialize a simple data store

if ( dataStore == null )

{

retrieveDataStore();

}



// History

if ( history == null )

{

history = new Array();

history[0] = currentPageNum;

debugLog("history[0]= 0");

}

executeAction("1");

}



/*

*

* Save page data to the in-memory data store

*

*/

function savePage( pageNum )

{

debugLog("savePage " + pageNum);

var pageObj = xfa.resolveNode(pageName[pageNum]);

if (pageObj != null)

{

var sXML = xfa.data.form1.saveXML();

dataStore[pageNum] = sXML;

}

}



/*

*

* Load page data from the in-memory data store

*

*/

function loadPage( pageNum )

{

debugLog("loadPage " + pageNum);

if ( pageNum > 0 && pageNum < pageName.length )

{

if ( dataStore[pageNum] != null && dataStore[pageNum] != "" )

{

xfa.data.form1.loadXML( dataStore[pageNum], true, true );

traceLog( xfa.data.saveXML() );

}

debugLog("history[" + history.length + "]=" + pageNum);

history[history.length] = pageNum;

}

}

Avatar

Former Community Member
I have subform named as page_1,page_5.



I want to display page_1 first after that to display page_5(second page).



Let me know how to use "pagination" in this scenerio?



using the script to call controller.executeAction("1") to display the page_1 subform.

Avatar

Level 10
I've seen that code before. What I think they do is create one subform per page and then hide/show the desired subform. What you'll need to do in you case is to make sure you show two subforms (page 1 and 2) when you select page one.



This is definitely possible. You just need to edit the code properly.



Jasmin

Avatar

Former Community Member
So what you're saying is: hiding / showing subforms in interactive forms at run-time is possible? I tried to achieve it by setting the presence attribute of a subform on checkbox click / change but it didn't work (javascript):

xfa.form.data.TextPage1.SubForm1.presence = "hidden"

I'd be really grateful if you could help me out on this topic.

But: I'm using Adobe Designer 7.0 (does it make any difference as far as this feature is concerned?)

Thanks in advance

Thomas

Avatar

Former Community Member
Are you sure you are saving (save as) your form as a Dynamic form and not a Static PDF form?

Avatar

Level 10
...and if you test your form from PDF Preview, make sure it previews the forms as a dynamic form.



Jasmin

Avatar

Former Community Member
Yes, I save it as a dynamic form. But so far I haven't got the transaction that creates the form & I only test it by watching the preview in the Designer. The entire script and all the settings seem to be right, so maybe it will work if created by the proper transaction - what do you think?

Thanks for the reply

Thomas

Avatar

Level 10
If it works in PDF Preview, it should work the same when you use it within LiveCycle.



Jasmin

Avatar

Former Community Member
Does anyone know how to automatically add a page in a pdf form. I have created a 2 page pdf in LiveCycle Design ES 8.1 and on the second page there is a huge simple text field. What I want is...if the user has used the required space in the text field then I want LiveCycle to automatically create the second page on another page that field so the user can continue. Is that possible? If so how? if you need code, what is it? Please HELP!!!!!!!!

Avatar

Former Community Member
First things first - make sure it is a dynamic form. Try to play with the subform properties (I mean this particular subform that contains the text field you're writing about). I'm not sure if I exactly understand what you want the final result to be but if you want the first part of the text field to be located at the end of the 1st page and the second part of the text field at the beginning of the 2nd at the same time, then I'm afraid it may be impossible...

Avatar

Former Community Member
Let's say I've got a subform that represents a single row of a table on my interactive form. The table is created by a binding to an internal table. My question is - how to hide only some of the shown rows (the ones that don't match a specified condition). For example: if there's a field 'CustNr' and the table contains records for a hundred customers (numbers 1 - 100), how to make the ones for which the CustNr is greater than 50 excluded from the layout? Is that possible?

And is there a way to change the DropDownList (also binded to an internal table) content once the form has been generated? I mean hiding some of the DropDownList items and showing them later. Could anyone give me a helping hand on this topic? I'd really appreciate any clue.

Thanks in advance