<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SharePoint &#187; 2007</title>
	<atom:link href="http://www.sharepointboris.net/tag/2007/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sharepointboris.net</link>
	<description>and Boris Gomiunik</description>
	<lastBuildDate>Thu, 22 Dec 2011 11:45:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Unable to authenticate + crawl errors on MOSS on Windows Server 2008</title>
		<link>http://www.sharepointboris.net/2009/12/unable-to-authenticate-crawl-errors-on-moss-on-windows-server-2008/</link>
		<comments>http://www.sharepointboris.net/2009/12/unable-to-authenticate-crawl-errors-on-moss-on-windows-server-2008/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 11:11:35 +0000</pubDate>
		<dc:creator>Boris Gomiunik</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint administration]]></category>
		<category><![CDATA[2007]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[Windows server 2008]]></category>

		<guid isPermaLink="false">http://www.sharepointboris.net/2009/12/unable-to-authenticate-crawl-errors-on-moss-on-windows-server-2008/</guid>
		<description><![CDATA[If you&#8217;re having some of the following symptoms: 1. You&#8217;ve created a web application and you&#8217;re sure that credentials are right, but you&#8217;re unable to login to the site collection in that web application. 2. Search index log returns strange errors about not finding the web application or access denied. Then the solution is in [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re having some of the following symptoms:</p>
<p>1. You&#8217;ve created a web application and you&#8217;re sure that credentials are right, but you&#8217;re unable to login to the site collection in that web application.</p>
<p>2. Search index log returns strange errors about not finding the web application or access denied. </p>
<p>Then the solution is in the following article:</p>
<p><a href="http://support.microsoft.com/kb/896861">http://support.microsoft.com/kb/896861</a>&#160;</p>
<p>This did the trick for me:</p>
<ol>
<li><strong>Start regedit</strong></li>
<li><strong>Open key HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLsaMSV1_0</strong></li>
<li><strong>Create a new multi-string value called &quot;BackConnectionHostNames&quot;</strong></li>
<li><strong><font color="#000000">Type web application&#8217;s host name(s) in the Value Data box.</font></strong></li>
</ol>
<p><font color="#000000" face="Arial">Save and close regedit. Then using <strong>Services</strong> under <strong>Administrative tools </strong>restart the <strong>IIS Admin service</strong></font></p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:66103573-c8ac-445b-96dc-854835e7706a" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/MOSS+2007" rel="tag">MOSS 2007</a>,<a href="http://technorati.com/tags/Windows+Server+2008" rel="tag">Windows Server 2008</a></div>
<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointboris.net/2009/12/unable-to-authenticate-crawl-errors-on-moss-on-windows-server-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint Lookup field: how does it work and how to add JavaScript event handler function to it?</title>
		<link>http://www.sharepointboris.net/2009/10/sharepoint-lookup-field-how-does-it-work-and-how-to-add-javascript-event-handler-function-to-it/</link>
		<comments>http://www.sharepointboris.net/2009/10/sharepoint-lookup-field-how-does-it-work-and-how-to-add-javascript-event-handler-function-to-it/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 22:23:04 +0000</pubDate>
		<dc:creator>Boris Gomiunik</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Lookup field]]></category>
		<category><![CDATA[2007]]></category>
		<category><![CDATA[3.0]]></category>
		<category><![CDATA[Lookup field]]></category>
		<category><![CDATA[SPFieldLookup]]></category>

		<guid isPermaLink="false">http://www.sharepointboris.net/2009/10/sharepoint-lookup-field-how-does-it-work-and-how-to-add-javascript-event-handler-function-to-it/</guid>
		<description><![CDATA[Due to a lot of comments and questions to my last year’s post about Attaching functions to SharePoint form fields concerning especially lookup fields on which the demo was made, I’ve decided to take a deeper dive into SharePoint’s Lookup Field and how to manipulate it client-side, since it behaves different in different situations. On [...]]]></description>
			<content:encoded><![CDATA[<p>Due to a lot of comments and questions to my last year’s post about <a href="http://www.sharepointboris.net/2008/04/add-functions-and-events-to-sharepoint-form-fields/" target="_blank">Attaching functions to SharePoint form fields</a> concerning especially lookup fields on which the demo was made, I’ve decided to take a deeper dive into SharePoint’s Lookup Field and how to manipulate it client-side, since it behaves different in different situations. On the image below you can see two lookup fields – rendered different.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://boris.gomiunik.net/wp-content/uploads/2009/10/image.png" width="537" height="160" /> </p>
<p>Even though new SharePoint is about to go public beta I’ll still show how to handle this in SharePoint 3.0 or 2007</p>
<p> <span id="more-489"></span><br />
<h4>How does it work?</h4>
<p>Before explaining how to attach a functon or event handler to a SharePoint lookup field let’s take a look on how SharePoint lookup field is rendered in HTML and which is its behavior – considering client-side.</p>
<h5><strong>Lookup to a list with less than 20 items</strong>:</h5>
<p>If your lookup field is reading from a list that has 19 or less items, the lookup field is rendered like a normal HTML dropdown field (HTML &lt;SELECT&gt; tag). The options in the select tag present possible choices. The text of the option is the lookup value, the value of the option is the lookup ID which SharePoint uses to properly link to the item.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://boris.gomiunik.net/wp-content/uploads/2009/10/image1.png" width="488" height="67" /> </p>
<p>The select has a title that equals the field display name, so you can easily use the getField function that is published <a href="http://www.sharepointboris.net/2007/07/refferencing-sharepoint-form-fields-with-javascript/" target="_blank">here</a>. So you can also easily bind an “onchange” event to it.</p>
<h5><strong>Lookup to a list with 20 or more items</strong></h5>
<p>When a list that the lookup field is reading from a list with 20 and more items, the story becomes more complicated. But only in IE. In FireFox and other browsers the lookup field with 20+ items still gets rendered as a SELECT element. In IE the story starts:</p>
<p>When a Lookup field has 20+ items in IE it gets rendered as a simulation of a combo box (SELECT). It is rendered as an INPUT text box with an image beside. The reason for this is to enable “auto suggest”/filtering feature as you type values in the INPUT textbox.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://boris.gomiunik.net/wp-content/uploads/2009/10/image2.png" width="448" height="105" /> </p>
<p>The image next to input element is pretty straightfoward. It has an “onclick” event that triggers the select. </p>
<p>The input field on the other hand has a lot of event handlers bound to it (keypress, keydown, keyup, etc. shown in the screenshot from IE Developer Tools below) that enable the combo box simulation. The input field also has a “Title” attribute that has a value of the field display name. </p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://boris.gomiunik.net/wp-content/uploads/2009/10/image3.png" width="489" height="160" /> </p>
<p>One of the attributes of the input field is also <strong>choices</strong> which contains all the ids and values of the lookup separated with the “|” character. </p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://boris.gomiunik.net/wp-content/uploads/2009/10/image4.png" width="428" height="228" /> </p>
<p>The first time you press a key or click the image next to the input field, a special function creates a SELECT element and positions it under the INPUT element. Each additional keypress when typing into the input field (typing in the lookup value) functions already attached to the input re-create the input with filtered values. The generated SELECT’s ID is determined with an attribute “<strong>opt</strong>” on the Input field. </p>
<p>&#160;<img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://boris.gomiunik.net/wp-content/uploads/2009/10/image5.png" width="482" height="168" /> </p>
<h5></h5>
<h5>The problem on DOM</h5>
<p>This DOM presents an issue to attach an “onchange” event to it since the input field already has so many onkeyup, onkeydown, onkeypress,… events. And since the Select element is generated on the fly it doesn’t exist when the page is rendered and there is only one SELECT element for all the lookup fields with 20+ items in the page. So we can’t attach an event handler to it. At least not easily.</p>
<h4>How to attach an event handler to a lookup field?</h4>
<p>The good news is that the re IS a way to add a function to trigger when the lookup field value has changed. The input field has another attribute &#8211; “<strong>optHid</strong>” which reveals the ID of a hidden input field that contains the selected lookup ID. That on the other hand is free of any event handlers and we can abuse it. </p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://boris.gomiunik.net/wp-content/uploads/2009/10/image6.png" width="507" height="262" /> </p>
<p>Since we won’t be typing into a hidden field we can’t add an “onkeyup” or “onkeypress” event to it. But we can add an “onpropertychange” event to it. I’ve read somewhere that this is working only in IE, but that’s ok since we are modifying the behavior for IE. Because the hidden field doesn’t have the title attribute we need to refference it indirectly through the input:</p>
<pre class="javascript" name="code"><strong>document.getElementById(getField('input','[field_display_name']').optHid)</strong></pre>
<h5></h5>
<h4></h4>
<h5>Enough theory – let’s make a practical example</h5>
<p>Let’s make a simple example. When you change a lookup field its ID and text should be coppied to another text field.</p>
<p>Because the SharePoint field can be rendered in two different ways we need to predict both. What we will need first is slightly modified function getField.</p>
<pre name="code" clas="javascript">function getField(fieldType,fieldTitle) {&#160; &#160;&#160;&#160; var docTags = document.getElementsByTagName(fieldType);&#160; &#160;&#160;&#160; for (var i=0; i &lt; docTags.length; i++) {&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160; if (docTags[i].title == fieldTitle) {&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return docTags[i];&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160; }&#160;&#160;&#160;&#160; }  &#160;&#160;&#160; <strong>return false;</strong>&#160; } </pre>
<p>The modification is in bold. What this change does is that the function returns <strong>false</strong> if it can’t find the specified element. Like that we can use it to specify if the field is INPUT (with 20+ items) or SELECT (with 19- items).</p>
<pre class="javascript" name="code">function copyLookupIdAndTxt() {
    if(getField('select','20+ Lookup'))
    {
        //if lookup has 19 or less items - SELECT
        lookupField = getField('select','20+ Lookup');
        lookupSelectedItem = lookupField.options[lookupField.selectedIndex];
        getField('input','Title').value = lookupSelectedItem.value + &quot;-&quot; + lookupSelectedItem.text;
    }
    else
    {
        //if it has 20 or more items - INPUT
        lookupFieldText = getField('input','20+ Lookup');
        lookupFieldId = document.getElementById(lookupFieldText.optHid);
        getField('input','Title').value = lookupFieldId.value + &quot;-&quot;+lookupFieldText.value;
    }
}</pre>
<p>&#160; <br />Next we create a function that will attach the created function to the lookup field (select or hidden input)</p>
<pre class="javascript" name="code">function addHandler() {
&#160;&#160;&#160; if(getField('select','20+ Lookup'))
&#160;&#160;&#160; {
&#160;&#160;&#160;&#160;&#160;&#160;&#160; getField('select','20+ Lookup').onchange = function() { copyLookupIdAndTxt() } &#160;&#160;&#160; } &#160;&#160;&#160; else  &#160;&#160;&#160; {  &#160;&#160;&#160;&#160;&#160;&#160;&#160; document.getElementById(getField('input','20+ Lookup').optHid).onpropertychange = function() { copyLookupIdAndTxt() }  &#160;&#160;&#160; }  }</pre>
<p>&#160; <br />and finally to make sure the handler gets added let&#8217;s add this to the spbodyonloadfunctionnames array</p>
<pre class="javascript" name="code">_spBodyOnLoadFunctionNames.push('addHandler');</pre>
<p>
  <br />and the function is adapted to SharePoint&#8217;s lookup field.</p>
<p>To recap: the entire code is as follows:</p>
<pre class="javascript" name="code">&lt;script type=&quot;text/javascript&quot;&gt;
function getField(fieldType,fieldTitle) {
      var docTags = document.getElementsByTagName(fieldType);
      for (var i=0; i &lt; docTags.length; i++) {
          if (docTags[i].title == fieldTitle) {
              return docTags[i];
          }
      }
      return false;
} 

function copyLookupIdAndTxt() {
    if(getField('select','20+ Lookup'))
    {
        //if lookup has 19 or less items - SELECT
        lookupField = getField('select','20+ Lookup');
        lookupSelectedItem = lookupField.options[lookupField.selectedIndex];
        getField('input','Title').value = lookupSelectedItem.value + &quot;-&quot; + lookupSelectedItem.text;
    }
    else
    {
        //if it has 20 or more items - INPUT
        lookupFieldText = getField('input','20+ Lookup');
        lookupFieldId = document.getElementById(lookupFieldText.optHid);
        getField('input','Title').value = lookupFieldId.value + &quot;-&quot;+lookupFieldText.value;
    }
}

function addHandler() {
    if(getField('select','20+ Lookup'))
    {
        getField('select','20+ Lookup').onchange = function() { copyLookupIdAndTxt() }
    }
    else
    {
        document.getElementById(getField('input','20+ Lookup').optHid).onpropertychange = function() { copyLookupIdAndTxt() }
    }
}

_spBodyOnLoadFunctionNames.push('addHandler');
&lt;/script&gt;</pre>
<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sharepointboris.net/2009/10/sharepoint-lookup-field-how-does-it-work-and-how-to-add-javascript-event-handler-function-to-it/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
	</channel>
</rss>

