Browser Enabled Infopath Vs Hyperlink window.
Hi All,
I have been struggling with this for about 4-5 days...with no much of luck..
I need to show a popup window (preferably a modal dialog) with predefined height & width, with no address bar & menu bar on click of an image in browser enabled infopath form (hosted in MOSS).
I tried the following optons with no luck..
- I tried masking the "button" control with an image, and then using notifyhost method and javascript..but after publishing the form to sharepoint, the image on the button is not displayed (it was displaying in preview though). So I couldn't proceed with this option.
- Later I have placed an image (and changed it to hyperlink) on the InfoPath form, saved it as source files, opened the "View1.xsl", and then tried to add some javascript to the hyperlink href attribute, still no go. The javascript function is not recognized and nothing happens when you click on image...
- I also tried embedding the below lines of code in the "View1.xsl" file and then calling the JS function, but no go.
<span style="DISPLAY: block; CURSOR: hand" onclick="Hello()">Click</span>
My form has a list of questionnaire, and some questions are tagged with images ( like help icons, what's this, etc.,). When user clicks on the images, I want to show the pop-up window with relative information. If I make the images as hyperlinks, the links are opened in normal IE window with restore button, and can be maximized to full screen. My users are not liking this....
I'm very much impressed by the "Save-As" dialog or "File Attachment" dialog which shows in browser enabled InfoPath ( it is a modal dialog with grey shade added to the parent window). Infact, I would want to show my pop-ups in the same way (if possible) else a normal window with predefined height and width ( with no address bar & menu bar) is fine.
Any help is highly appreciated...
regards,
Srikanth
Answers
- You can try implementing this in 2 ways.
option 1:
Using the images as hyperlinks. Point the hyperlink to an intermediary page. This intermediary page should have a javascript function which will execute on page. The javascript function should open a pop up window with your requirements (required width/height, no address bar etc) and then close the intermediary window (self.close()).
option 2:
using the buttons event handler and using notifyhost event. In the hosting aspx page call the javascript function [ClientScript.RegisterStartupScript(typeof(string), "AlertScript", "window.showModalDialog(...)", true);] which will open the pop up window. But there is a catch here because the page reloads on the click of the button and the javascript opens up the pop up window but in the parent window the infopath form stops loading and is blank. Closing the pop up will render the form in parent window. To get around this you can modify the javascript call to as following:
[ClientScript.RegisterStartupScript(typeof(string), "AlertScript", "setTimeout ("window.showModalDialog(...)", 500);", true);]
It waits for the page to load and then opens up the pop up.
hope it helps!
Srinivas Varukala http://sharenotes.wordpress.com- Marked As Answer byLu Zou-MSFTMSFT, ModeratorFriday, November 13, 2009 6:54 AM
All Replies
Browser based forms will not allow pop-up's. I'll check with my InfoPath dev team to confirm and report back.
Kris Wagner, MCITP, MCTS Twitter @sharepointkris Blog: http://sharepointkris.com- You can try implementing this in 2 ways.
option 1:
Using the images as hyperlinks. Point the hyperlink to an intermediary page. This intermediary page should have a javascript function which will execute on page. The javascript function should open a pop up window with your requirements (required width/height, no address bar etc) and then close the intermediary window (self.close()).
option 2:
using the buttons event handler and using notifyhost event. In the hosting aspx page call the javascript function [ClientScript.RegisterStartupScript(typeof(string), "AlertScript", "window.showModalDialog(...)", true);] which will open the pop up window. But there is a catch here because the page reloads on the click of the button and the javascript opens up the pop up window but in the parent window the infopath form stops loading and is blank. Closing the pop up will render the form in parent window. To get around this you can modify the javascript call to as following:
[ClientScript.RegisterStartupScript(typeof(string), "AlertScript", "setTimeout ("window.showModalDialog(...)", 500);", true);]
It waits for the page to load and then opens up the pop up.
hope it helps!
Srinivas Varukala http://sharenotes.wordpress.com- Marked As Answer byLu Zou-MSFTMSFT, ModeratorFriday, November 13, 2009 6:54 AM


