Opening a new window from a Infopath 2007 browser-enabled form...

D

Dibs

Hi All,

I need some help.. I need to design a browser-enabled Infopath 2007 form
where there will be 2 option buttons - Yes/No for Medical Dependents. If the
user clicks on 'Yes' then a small new window will open which will display the
dependent data for that particular user.
The code to fetch the dependent data is known to me but how to open a new
window in a browser enabled Infopath 2007 form. I think i will have to use
the code behind for the option button.
Can anyone help me in this regard..? Any suggestions are welcome..

Cheers,
Dibs
 
K

Kalyan G Reddy MVP (GGK Tech)

Hello Dibs

When you say that you will show a small window when you select Yes, what is
that window made of, Is it another IP form you want to show or another IP
form or just show some hidden section?
 
D

Dibs

Hi Kalyan,

An aspx page will be displayed in the window. If aspx page cannot be shown
by any means, then I will have to show and IP form.
actually this small window will show the dependent details of that
particular user. So it will have to fetch data from the database.
Whatever it gets to be, I have to display the info in a pop-up.

Regards,
Dibs
 
S

S.Y.M. Wong-A-Ton

You will have to use javascript for this. And the only way to use javascript
with browser forms is by hosting the form in a custom web page. If someone
does not beat me to it, I'll soon write and post an article about this topic
on the MS support site.

BTW, you seem to post and ask questions regularly in this group. Can you
take a few minutes out of your time to answer a few or all of the questions
that a member of the InfoPath team recently posted? Take a look at his post
here:
http://msdn.microsoft.com/newsgroup...-DC48AB0DA5C9&dglist=&ptlist=&exp=&sloc=en-us

Thanks!
 
D

Dibs

I have actually tried it by hosting the IP form in a XMLFormView control in
an ASP.Net page. The problem I am facing is that I cannot capture the
controls that are inside the IP form(for e.g a button control). When I look
at the viewsource of the completed page, I get the controls as a javascript
array consisting of all the controls. Its not possible to distiguish the
individual controls in the Infopath form.
Looking forward to your article.

BTW.. I have answered the questions in the '7 questions about form usage'
post...

Cheers,
Dibs
 
S

S.Y.M. Wong-A-Ton

Thanks much for answering the questions from the InfoPath team member; your
answers will also give me an idea of who is in the group and how to target
the content I usually write.

Regarding the issue you're having: You need to use NotifyHost to communicate
between the form and the ASP.NET page (see
http://msdn2.microsoft.com/en-us/li...h.server.controls.xmlformview.notifyhost.aspx).

It will take me at least a week or two to get the article up, since it has
to go through a review process, but it is currently at the top of my list and
in it I will elaborate on how to hook up the communication between form and
page. It is not complex once you have it set up, but it does require a bit of
explaining. If you want to have a go at it before the article comes out,
please do. Post any questions you may have and I'll try to help you out.
 
S

S.Y.M. Wong-A-Ton

I'm just about done writing the article, but was wondering whether you've
already tried using the hyperlink control to open a new window. I'm asking
this, because using JavaScript might not work as desired/smoothly, since the
form will have to do a postback before running the script; you wouldn't get
this negative effect if you used a hyperlink control to open a new window.
 
D

Dibs

I have tried the hyperlink control. it does open a new window. But it does
not actually serve my purpose. I need to open a new window from a check box
click or an option button click.
Anyways, do let me know when you have posted your article. Thanks in
advance...
 
S

S.Y.M. Wong-A-Ton

I'm hoping to get it out by Monday next week, but it all depends on my
reviewers. I'll post the link to it as soon as it has been published.
 
S

S.Y.M. Wong-A-Ton

Thanks to my reviewers on the MS Office documentation team, I was able to
publish the article before its intended publication date. You can find it
here: "How to execute JScript code from an InfoPath 2007 browser-enabled form
template" @ http://support.microsoft.com/kb/555990

I've included two examples in it:
1. How to display a message box from a browser form
2. How to open a new browser window from a browser form

Have fun! And if you have any feedback, please do fill out the form below
the article.
 
S

Srinidhi Koushik

Hi S.Y.M. Wong-A-Ton,
I have gone through your above mentioned article and have a few questions -
1.how do i add the xmlformviewcontrol to my aspx page ,as i cannot see it in my tool bax ?
2.Why does this code on a infopath form button click event not work ?

string strBody = "<html>" +
"<body>" +
"<div>Your name is: <b>" +
"<table width=100% style=background-color:#cfcfcf;><tr><td>1st Cell body data</td><td>2nd cell body data</td></tr></table>" +
"Ms Word document generated successfully." +
"</body>" +
"</html>";
string fileName = "MsWordSample.doc";

// You can add whatever you want to add as the HTML and it will be generated as Ms Word docs
HttpContext.Current.Response.AppendHeader("Content-Type", "application/msword");
HttpContext.Current.Response.ContentType = "application/msword";
HttpContext.Current.Response.AppendHeader ("Content-disposition", "attachment; filename="+ fileName);
HttpContext.Current.Response.Write(strBody);
3. I fail to understand this ?
Please help me
sriniko
 

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