Expand my Community achievements bar.

SOLVED

How to close a form within script

Avatar

Level 2

Hello,

I'm using Adobe LiveCycle Designer v 8.2 to develop an Order form. I'm fairly new to developing in LiveCycle, and would like to ask the following question that I couldn't find an answer to elsewhere.

I'd like to know if it is possible to close a form down within a script, if certain conditions are met/not met. Specifically, when my form loads I am testing the user's version of Acrobate Reader. If it is not above the stated version, I would like the form to close down. At the moment, it displays the warning message correctly but then continues to try and load the form.

I guess the JavaScript equivalent of Me.Close() is what I am after

if

(xfa.host.version < 8.101)

{

xfa.host.messageBox("Your version of Adobe Acrobat Reader is not recent enough to use this form.",

"Wrong version of Adobe Acrobat", 1);

//Code to close form to go here

}

Can anyone help?

Thanks

Matt

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

I tried it in 8 and 9 and it worked fine ....there may have been a bug on that version but I do not have it to test with.

Paul

View solution in original post

3 Replies

Avatar

Former Community Member

You will be able to close the form but you will not be able to close the Reader application. The command you want is event.target.closeDoc(). This will close the currently active Document. Note that if you are diosplaying in a browser then it will not close the doc ....it will only work form the Reader/Acrobat applications.

Paul

Avatar

Level 2

Hi Paul,

Thanks very much for the response. I've added the code and it does close the form when needed, the problem is that it also crashes Acrobat Reader (version 7.0). Is there any other code that I should add around the event.target.closeDoc() statement to ensure a 'clean' closure of the form?

Thanks

Matt

Avatar

Correct answer by
Former Community Member

I tried it in 8 and 9 and it worked fine ....there may have been a bug on that version but I do not have it to test with.

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----