Switch to previous view on button click - InfoPath Dev
in

InfoPath Dev

Switch to previous view on button click

Last post 02-22-2009 08:27 PM by Votsar. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 02-16-2009 05:26 PM

    • Votsar
    • Not Ranked
    • Joined on 02-08-2009
    • Posts 4

    Switch to previous view on button click

    Hey all,

     I'm designing some forms that will be published to MOSS, and because they are web-forms, you cannot have popups etc.

    The current form I'm busy with has about 10 different views, with a 'Cancel' button on each view. The business requirements is to have a 'Are you sure?' type request before closing the form when someone clicks 'cancel'. I've added a new view called 'Cancel' with a 'yes' and 'no' button on it, that will be navigated to whenever someone clicks on 'cancel' in one of the 10 views.

    My problem is: if a user accidentally clicks 'cancel', they get taken to the 'cancel' view. however, because it was a mis-click or something, they don't wan't to close it, so they click 'no'. My question is how do I take them back to the previous view that they were on? Is there a way to say "switch to view (x)" where x is a variable or hidden field or something that contains the previous view?

     

    Thanks for any help

  • 02-16-2009 09:41 PM In reply to

    Re: Switch to previous view on button click

    Hi,

    Add a hidden field to the data source.

    Add an OnSwitchView event to the form and in the event write the following code.

     

    if (thisXDocument.View.Name != "<Cancel view name>")

    {

    thisXDocument.DOM.selectSingleNode("<XPath of the hidden field>").text = thisXDocument.View.Name;

                   

    }

    Add an on click event for the ‘No' button and write the following code.

    viewName = thisXDocument.DOM.selectSingleNode("<XPath of the hidden field>").text;

    thisXDocument.View.SwitchView(viewName);

    Swathip
    www.ggktech.com
  • 02-22-2009 08:27 PM In reply to

    • Votsar
    • Not Ranked
    • Joined on 02-08-2009
    • Posts 4

    Re: Switch to previous view on button click

    Awesome, thanks - works like a charm :)
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.