Most of the examples of using dialogs in SharePoint refer to calling other pages, effectively creating a popup iframe. This approach is both useful and reasonably well documented (Charlie Holland’s blog has the best examples I’ve seen to date).
What isn’t well documented is using SharePoint modal dialogs to render dynamically generated html. When you call SP.UI.ModalDialog.ShowModalDialog you need to pass in a SP.UI.DialogOptions object. Charlie kindly posted the list onto MSDN, but with regards to passing in html it’s incorrect. It seems to indicate that raw html can be passed in.
However if you try this you’ll just get an error like this:
Message: Object doesn't support this property or method Line: 2 Char: 18225 Code: 0 URI: http:///_layouts/sp.ui.dialog.js?rev=IuXtJ2CrScK6oX4zOTTy%2BA%3D%3D
This is because the string that gets passed in is evaluated for nodeType (if you want to check for yourself, see around line 764 in SP.UI.Dialog.debug.js, there is a function that the html string is passed into with a definition that looks like $13_0: function($p0).
What this means is that you have to pass in a DOM element.
Do that, and you’ll get your dynamic-html dialog!
With FAST for SharePoint being so new, it’s difficult to know how to work with the product when it comes to debugging. There are many different questions:
For all of these questions, the QRServer is an invaluable tool.
The Query Result (QR) Server, is a way to speak with FAST directly, without worrying about SharePoint. It’s a web site, accessible only to users logged in to the FAST server that allows users to fire queries into FAST and see the resulting XML. This is important because it allows users to rule-out (or in) SharePoint as the culprit for broken searches.
By default, the QR Server respects content security rules, so using different accounts on the QR Server will give you different results.
You access the QR Server via a web-browser. The url to type is http://<fastservername>:<basePortNumber+280>/. So let’s say the ever popular contoso.com is served by a FAST server with the name http://fsContoso1.controso.com using the default base port number of 13000. In that case you’d need to navigate to http://fsContoso1.controso.com:13280.
The QR Server is ONLY accessible directly from a FAST server, so you must Remote Desktop onto the server to use it. From there, you find your base port number by looking at the hostconfiguration.xml in the < FASTInstallLocation>/etc/ folder
The FAST Query Game
Debugging queries in a production or UAT environment is a serious pain. This technique was taught to me by a FAST Ninja (thanks Torstein!) and is a bit bizarre. It involves running a query from SharePoint and then extracting the data passed to FAST out of a log file and manually resubmitting the query on the FAST server, all within 15 seconds.
This approach is necessary because along with your query, SharePoint sends FAST a user authorization token that is only valid for a short period of time.
STEP 1: On your SharePoint FAST Search Centre, execute your query
STEP 2: Quickly switch to the FAST server and into the the FAST log folder. Open the most recent log file in Notepad and navigate to the bottom, making sure Word Wrap is on.
STEP 3: Take the last url in the file
You will need to grab the url from the querystring, taking everything after “search?” until the HTTP/1.1 text. In a production environment this can span multiple lines and be tricky to select within the 15 second limit. This is usually the part where I run out of time.
STEP 4: On the QR Server, paste the querystring into the location noted below
STEP 5: Hit “go”, “enter” or whatever to start your search and see the results FAST sent back to SharePoint
If you run out of time, you’ll see the same QUERYTRANSFORMS elements, but nothing else.
Following a successful round of the FAST Debugging game, you can investigate the results. I can’t possibly describe each element, but at a high-level:
I’ll talk more about interpreting the results in my next post, but for now, I hope this helps.