Close a browser enabled form from Javascript

C

Chris

Hi,

I've got 2 InfoPath 2007 browser-enabled forms hosted on a Forms
Server. The first form contains a hyperlink to the 2nd form. When
the User clicks on the link, the second form opens in a new Window.
When the user clicks on the Close button on the second form, I want
the browser window to close.

So in the C# code behind Close button click event I want to
effectively render some Javascript code that would fire a
window.close() statement;

Is there any way to do this?


Thanks
 
G

Gavin McKay

Hello,

I don't know of any way to achieve this - Forms server creates its content
on the server so AFAIK you can't insert your own content on the fly as you
can with (for example) ASP.NET. There is no object model access to the
output stream so you can't really "insert" HTML on-the-fly.

You might be able to hack one of the view xsl files to add in your own
custom code on an element, but I've never tried that. Would be an
interesting experiment :) I've posted some info about the internal structure
of template files and how to access them here:

http://www.infopathkb.com/ (no registration required)

but basically you would need to access the view*.xsl file of your particular
view and try to add in content to the view. Be careful though, it's quite
possible that this could corrupt your template if it doesn't work. I'd
recommend several backups if you're hacking at this level :D

HTH

Gavin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top