Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

livecycle form - disable save functionality at runtime

Avatar

Former Community Member

Hello,

is it possible to dynamicly restrict user to not to be able to save changes in a form ?

We want to let the user to choose some application-specific custom security choice. In some security level, we want to disable the ability to save filled data (the data can be still post to a server).

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Generally, you can't disable save. The user can at any stage access Save or Save As from the File menu. They can also press Control+S.

If you include the following javascript in the layout:ready event of the root node, then the user may not be prompted to save the form:

event.target.dirty = false;

Overall, the user can still save the form.

Hope that helps,

Niall

Assure Dynamics

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

Generally, you can't disable save. The user can at any stage access Save or Save As from the File menu. They can also press Control+S.

If you include the following javascript in the layout:ready event of the root node, then the user may not be prompted to save the form:

event.target.dirty = false;

Overall, the user can still save the form.

Hope that helps,

Niall

Assure Dynamics

Avatar

Former Community Member

Thank You Niall.

I have read that there is option to hide menubar with save option. I assume, that this will not prevent the user from using Ctrl+S shortcut.

When working with [Form Properties -> Defaults -> Preserve scriptiong changes -> Manually] would it be possible to use workaround, in that we would store form values to a javascript object on preSave + clear the form fields, let the save be done and in postSave refill form fields from javascript object ?

Then we need that javascript object not to be stored in the saved file.

Thanks.

Avatar

Level 10

Hi,

Even if you hide the toolbar, the user will still be able to Control+S.

Also setting the preserve script changes to manual, really only affects changes that occur due to script changes. So data typed in sill be saved even if the preserve is set to manual.

You could possibly do a preSave/postSave workaround, but you would want to warn the user. They may think that there data is saved and get a nasty surprise when they find out it is not. You could use the initValue. However be aware that if the target version is set to v8.1 or below then 'Enforce strict scoping rules in JavaScript' can be ticked. If however the target version is set to v9 or above, then you have to de-select the scoping rules.

The script in the mouseDown and mouseUp events of the radio buttons in this example will show how the initValue works. http://assure.ly/i5BXCm

Hope that helps,

Niall