Showing an alert and closing the form - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Showing an alert and closing the form

Last post 05-07-2007 04:07 PM by Terry G Phillips. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 04-13-2007 08:08 AM

    Showing an alert and closing the form

    Hello,

    It sounds stupid but I've not managed to find the way to send an alert message to the user nor to close the form by code.

    I know I can achieve that using rules but in my case, rules aren't appopriate.

    I'm using infopath 2007 browser-enabled forms. I've seen some doc about the XDocument object that existed in infopath2003 (which I don't know) but it does not look to work the same way in 2007.

    Any help would be greatly appreciated.

    Thanks
  • 04-13-2007 09:38 AM In reply to

    Re: Showing an alert and closing the form

    There is a Close() method on the XmlForm object.

    For the alert, you just pop up a MessageBox.
  • 04-13-2007 03:23 PM In reply to

    Re: Showing an alert and closing the form

    Hello Greg,

    I'm currently at home so I don't have access to infopath but I tried already to use MessageBox but this is not allowed in browser forms. When trying to upload it onto the Sharepoint server, there is error stating that system.windows.forms is not allowed in browser-enabled forms.

    Regarding XmlForm, I don't remember to have seen it but I'll check it on Monday.

    Thanks for your answer anyway :)
  • 04-16-2007 04:10 AM In reply to

    Re: Showing an alert and closing the form

    UP!

     

    I can confirm now that this is not possible to use MessageBox which sounded really wierd to me but....since the MOSS admin interface won't let you upload a form referencing system.windows.forms. Moreover, I think that this is actually not possible to close a browser-enabled form trhough the code. Having a look at http://download.microsoft.com/download/0/9/c/09cda3f2-6d3d-4082-aec5-9a62b7679ecf/InfoPathObjectModelMap.pdf clearly demonstrates that the Close & the Quit methods of xmlform is unavailable to browser forms. I guess that Microsoft didn't implement another way to close the form....

    This is really a pity to notice that such basic functionality are not implementable in browser-forms except by using rules which are neither available in the code behind....I think I'm gonna chose another product than infopath for future developments. Moreover, most of the documentation around forms services is wrong or suspicious.

  • 04-16-2007 10:38 AM In reply to

    Re: Showing an alert and closing the form

    Sorry -- should have noticed you said you were using browser form. There's a lot of functionality not available to the browser forms. Why you can't display a message box (basic JavaScript alert() functionality) is beyond me.

    Good luck!

  • 04-30-2007 10:31 PM In reply to

    Re: Showing an alert and closing the form

    Browser enabled forms are really restrictive in their functionality. I am struggling with some of that right now. Alerts are not allowed and microsoft recommends using hidden sections to display messages. i.e. create a hidden section with a text box with message and keep it hidden until you want to display it on some trigger. The problem I am trying to figure out is how to focus the user's attention to the section if its a long form and you may have to scroll to it.
  • 05-04-2007 03:03 PM In reply to

    Re: Showing an alert and closing the form

    You could try to switch to another view. You build a view with an error message textbox and a back button to get back to your previous view. As soon as an error occurs, you set a value to a field that triggers a rule that switchs view.

    Would be better to be able to display an alert box but.... 

     

  • 05-07-2007 04:07 PM In reply to

    Re: Showing an alert and closing the form

    Yes - there is a hack way around this. I perform all my submits in code, to both a SQL db and SPList.

    Set your: Tool - Submit Options to send data to a fake webservice. Then under Advanced, choose After submit: "Close the form"

     The webform will go away.

     Too bad, this won't work when opened with IP...

     Hope this helps,

    Terry

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