Disable, clear or delete History (undo & redo) - InfoPath Dev
in

InfoPath Dev

Disable, clear or delete History (undo & redo)

Last post 10-16-2014 11:04 AM by Upender Singh. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 03-03-2008 07:58 AM

    Disable, clear or delete History (undo & redo)

    Hi,

     One of my community user ask me this:

     Is it possible for a formular to desactivate (code or not) totallly undo or redo?

    Is it possible on a button click to clear all the history?

    Is it possible to delete partially this history? to keep only the ten or twenty last action? Is it possible to set a maximum of ten undo as default?

     Have you any information about that?

     Thanks

    Thierry

     

    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 03-03-2008 11:08 AM In reply to

    Re: Disable, clear or delete History (undo & redo)

    Undo history is cleared when a view is changed. There is not partial clearing of undo history.

  • 03-04-2008 12:03 AM In reply to

    Re: Disable, clear or delete History (undo & redo)

     Hi Greg,

     Ok thanks for your answer.

     
    Thierry
     

    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 03-04-2008 09:07 AM In reply to

    Re: Disable, clear or delete History (undo & redo)

    Well, as far as disabling undo/redo, you can do some things programmatically. The OnBeforeChange event (IP2007 OM, equivalents exist in IP2003 as well) is cancellable and has the IsUndoRedo flag.

    You can check this flag and do things when it's true. For example, this will effectively disable Undo/Redo:

    public void myFields_OnBeforeChange(DataDOMEvent e)
    {
     
    if (e.IsUndoRedo)
     {
      e.ReturnStatus =
    false;
     }
    }

    Note that this will not disable undo within the textbox because no event is fired until you tab out. This undo cannot be ever disabled. However, once you tab out, Undo will be blocked with the code above.

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 03-04-2008 09:32 AM In reply to

    Re: Disable, clear or delete History (undo & redo)

    Thanks for the further ideas, David! So when you say "block" do you mean that once this is hit, it effectively prevents access to the undo stack at that point? If so, and you want to completely disable undo, would you need to add this code for every node in the form, or could you do it once at the root node (on account of event bubble up)?

  • 03-04-2008 09:38 AM In reply to

    Re: Disable, clear or delete History (undo & redo)

    Root node is good enough - with this code in place hitting undo/redo will have no effect (unless you have not tabbed out yet, this cannot be disabled). Also you can do it conditionally based on some logic you may have (like a checkbox saying "disable undo/redo").

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 03-10-2008 06:07 AM In reply to

    Re: Disable, clear or delete History (undo & redo)

     Hi David,

     
    Thanks for this trick this is very interesting. I will try to do like this and
    me and my user thanks you a lot.

     
    ++


    Thierry
     

    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 10-16-2014 11:04 AM In reply to

    Re: Disable, clear or delete History (undo & redo)

    Hello David,

    I am new to infopath and coding.

    I designed the form on which I want to disable undo so no changes can be made.

    I have tried the above code but it not blocked the undo or redo once you tab out.

    Could you please help as how to block the undo once the feild is tab out.

    Thanks for your support in advance.

    Regards,

    Upender Singh

    Regards,

    Upender Singh
Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.