Expand my Community achievements bar.

Looking for a way to detect whether a document has been changed

Avatar

Level 2

We have a document with a "validate" button.

Pressing this button performs several validations and the result will be : "validated" or "not validated"

The result is being displayed to the end user as a document status (with it's own color).

Once the new "status" = "validated", the status should be automatically reset to "not validated" when the user makes 1 of more change to the document.

Is there an easy way to do this?

Is there a sort of document status you can fetch?

5 Replies

Avatar

Level 10

Hi,

I'd say it is possible. You could propogate a enter event and an exit event and compare the values of the field before and after. If there is a change in values then change the status.

You would set up a script object with an enter function first and then an exit function.

Are you up for that?

Niall

Avatar

Level 2

Hello,

Thanks for your reply.

I understand what you are saying but I am not familiar with propogating events.
Could you provide some more information? Or maybe a small example?

Regards,

Nico

Avatar

Level 10

Hi Nico,

I am sure that John Brinkman discusses propogating events on his blog. http://blogs.adobe.com/formfeed/

I can't do up a sample at the moment, but will try and get something done over the next day or two.

Niall

Avatar

Former Community Member

Niall's way wil lwork but this one might be easier.

Acrobat has a "dirty" flag that gets set each time a change is made to the doc. This is what tells Acrobat that you need to do a save when you quit. You can test this flag yourself. To access it use:

event.target.dirty

This will return true if a change has been made and false if no changes have been made. Note that if someone enters data into a field and then deletes that data the flag will still be true as a change was deemed to have been made.

Paul

Avatar

Level 10

Good catch Paul

Yes, that is much simpler. I keep forgetting about the dirty flag.

Niall