<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>WSS 3.0 &amp; MOSS 2007</title><link>http://blogs.vbcity.com/skullcrusher/category/194.aspx</link><description>Code &amp; insites for WSS 3.0 &amp; Microsoft Office SharePoint Server 2007</description><managingEditor>Andy Bonner</managingEditor><dc:language>en-NZ</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>Andy Bonner</dc:creator><title>How to set SharePoint People Picker default value to current user through javascript</title><link>http://blogs.vbcity.com/skullcrusher/archive/2008/04/10/9024.aspx</link><pubDate>Thu, 10 Apr 2008 09:08:00 GMT</pubDate><guid>http://blogs.vbcity.com/skullcrusher/archive/2008/04/10/9024.aspx</guid><wfw:comment>http://blogs.vbcity.com/skullcrusher/comments/9024.aspx</wfw:comment><comments>http://blogs.vbcity.com/skullcrusher/archive/2008/04/10/9024.aspx#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.vbcity.com/skullcrusher/comments/commentRss/9024.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/skullcrusher/services/trackbacks/9024.aspx</trackback:ping><description>&lt;P&gt;I found this great &lt;A href="http://blogs.msdn.com/sharepointdesigner/archive/2007/06/13/using-javascript-to-manipulate-a-list-form-field.aspx"&gt;POST&lt;/A&gt;&amp;nbsp;by the SharePoint Designer team for &amp;#8220;Using Javascript to Manipulate a List Form Field&amp;#8221;.&amp;nbsp; Unfortunately it didn't work very well for People Picker fields which is exactly what I needed to do today.&lt;/P&gt;
&lt;P&gt;After some trial and error, and a bit of head scratching I finally came up with the follow which I thought I'd share, since when I was searching for a solution I found a lot of people in a similar situation with no solution posted.&lt;/P&lt;!-- -- block code of --Start&gt;
&lt;DIV onkeydown="var k =event.keyCode,i=-1,ch=this.firstChild;if(k==32){i=ch.sel;if(++i==ch.selcount)i=0;}else i = k - 49;if(i&gt;=0 &amp;amp;&amp;amp; i&lt;ch.selcount){ch.sel=i;ch.click();}" style="BORDER-RIGHT: #000080 1px solid; BORDER-TOP: #000080 1px solid; MARGIN-LEFT: 10pt; BORDER-LEFT: #000080 1px solid; MARGIN-RIGHT: 2pt; BORDER-BOTTOM: #000080 1px solid"&gt;
&lt;DIV style="FONT: 11px Microsoft Sans Serif; BORDER-BOTTOM: #000080 1px solid" onclick="var i=this.sel,j,ch,count = this.selcount;if(i==this.selold)return;this.selold=i;for(j=0;j&lt;count;j++){ch=this.childNodes[2+j];ch.childNodes[0].checked=j==i;ch.style.fontWeight = j==i ? 'bolder' : 'normal';}ch=parentNode.childNodes[1];var sh=new Array('none','');j=i==0?0:1;ch.style.display=sh[j];ch.nextSibling.style.display=sh[1-j];var h =ch.offsetHeight;ch.style.height=i==1?'125pt':null;if(i==1&amp;amp;&amp;amp; ch.offsetHeight&gt;h)ch.style.height=h;" selcount="3" selold="1" sel="1"&gt;&lt;B&gt;Code &lt;/B&gt;&lt;A style="MARGIN-LEFT: 10pt; MARGIN-RIGHT: 10pt" onclick="window.clipboardData.setData('Text',this.parentNode.parentNode.childNodes[1].innerText);alert('Code copied to clipboard');" href="javascript:"&gt;Copy&lt;/A&gt;&lt;SPAN style="MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=0&gt;&lt;INPUT onclick=this.blur(); type=radio&gt;Hide&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bolder; MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=1&gt;&lt;INPUT onclick=this.blur(); type=radio CHECKED&gt;Scroll&lt;/SPAN&gt;&lt;SPAN style="MARGIN-LEFT: 5pt; CURSOR: hand; MARGIN-RIGHT: 5pt" onclick=parentNode.sel=2&gt;&lt;INPUT onclick=this.blur(); type=radio&gt;Full&lt;/SPAN&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;&lt;/DIV&gt;
&lt;DIV style="OVERFLOW: auto; HEIGHT: 125pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;script&lt;/FONT&gt; &lt;FONT color=#ff0000&gt;type&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="text/javascript"&amp;gt;&lt;/FONT&gt;&lt;BR&gt;_spBodyOnLoadFunctionNames.push(&lt;FONT color=#a31515&gt;"fillDefaultValues"&lt;/FONT&gt;);&lt;BR&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;function&lt;/FONT&gt; fillDefaultValues() &lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;fillPeoplePickerWithCurrentUser(&lt;FONT color=#a31515&gt;'Submitted_x0020_By'&lt;/FONT&gt;);&lt;/DIV&gt;}&lt;BR&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;function&lt;/FONT&gt; fillPeoplePickerWithCurrentUser(pickerName)&lt;BR&gt;{&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;//get the current user from the welcome menu&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;var&lt;/FONT&gt; currentUser = getCurrentUser();&lt;BR&gt;&lt;FONT color=#008000&gt;&lt;BR&gt;//check to see that we've got it&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt;(currentUser != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)&lt;BR&gt;{&lt;FONT color=#008000&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;//get the people pickers input div&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;var&lt;/FONT&gt; pp = getPickerInputElement(pickerName);&lt;FONT color=#008000&gt;&lt;BR&gt;//set it to the current user if we've found it&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;if&lt;/FONT&gt;(pp != &lt;FONT color=#0000ff&gt;null&lt;/FONT&gt;)
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;pp.innerHTML = currentUser;&lt;/DIV&gt;&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;BR&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;function&lt;/FONT&gt; getCurrentUser()&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;var&lt;/FONT&gt; tags = document.getElementsByTagName(&lt;FONT color=#a31515&gt;'a'&lt;/FONT&gt;);&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;for&lt;/FONT&gt; (&lt;FONT color=#0000ff&gt;var&lt;/FONT&gt; i=0; i &amp;lt; tags.length; i++)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt;(tags[i].innerText.substr(0,7) == &lt;FONT color=#a31515&gt;'Welcome'&lt;/FONT&gt;)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;return&lt;/FONT&gt; tags[i].innerText.substr(8,tags[i].innerText.length);&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;BR&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;function&lt;/FONT&gt; getPickerInputElement(fieldsInternalName)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;var&lt;/FONT&gt; result&amp;nbsp;&amp;nbsp;= &lt;FONT color=#a31515&gt;""&lt;/FONT&gt;;&lt;FONT color=#0000ff&gt;&lt;BR&gt;var&lt;/FONT&gt; divs = document.getElementsByTagName(&lt;FONT color=#a31515&gt;"DIV"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;for&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;var&lt;/FONT&gt; i=0; i &amp;lt; divs.length ; i++)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt;(divs[i].id==&lt;FONT color=#a31515&gt;"WebPartWPQ2"&lt;/FONT&gt;)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;var&lt;/FONT&gt; tds = divs[i].getElementsByTagName(&lt;FONT color=#a31515&gt;"TD"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;for&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;var&lt;/FONT&gt; j=0; j &amp;lt; tds.length; j++)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;var&lt;/FONT&gt; cellHTML = tds[j].innerHTML;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 80pt"&gt;if&lt;/FONT&gt;(cellHTML.indexOf(&lt;FONT color=#a31515&gt;'FieldInternalName="'&lt;/FONT&gt; + fieldsInternalName + &lt;FONT color=#a31515&gt;'"'&lt;/FONT&gt;) &amp;gt;= 0)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;var&lt;/FONT&gt; innerDivs = tds[j].getElementsByTagName(&lt;FONT color=#a31515&gt;"DIV"&lt;/FONT&gt;);&lt;FONT color=#0000ff&gt;&lt;BR&gt;for&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;var&lt;/FONT&gt; k=0; k &amp;lt; innerDivs .length; k++)&lt;BR&gt;{&lt;FONT color=#0000ff&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;if&lt;/FONT&gt;(innerDivs[k].id.indexOf(&lt;FONT color=#a31515&gt;"UserField_upLevelDiv"&lt;/FONT&gt;) &amp;gt; 0)&lt;BR&gt;{
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;result = innerDivs[k];&lt;FONT color=#0000ff&gt;&lt;BR&gt;break&lt;/FONT&gt;;&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 60pt"&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 40pt"&gt;}&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;return&lt;/FONT&gt; result;&lt;/DIV&gt;}&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;script&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;SPAN style="FONT-FAMILY: Times New Roman"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV ondblclick="var o = parentNode.firstChild;o.sel =1;o.click()" style="DISPLAY: none; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;B&gt;. . .&lt;/B&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;&lt;img src ="http://blogs.vbcity.com/skullcrusher/aggbug/9024.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Andy Bonner</dc:creator><title>Get list of site users in InfoPath form</title><link>http://blogs.vbcity.com/skullcrusher/archive/2006/12/20/7733.aspx</link><pubDate>Wed, 20 Dec 2006 11:40:00 GMT</pubDate><guid>http://blogs.vbcity.com/skullcrusher/archive/2006/12/20/7733.aspx</guid><wfw:comment>http://blogs.vbcity.com/skullcrusher/comments/7733.aspx</wfw:comment><comments>http://blogs.vbcity.com/skullcrusher/archive/2006/12/20/7733.aspx#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://blogs.vbcity.com/skullcrusher/comments/commentRss/7733.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/skullcrusher/services/trackbacks/7733.aspx</trackback:ping><description>&lt;P&gt;&lt;FONT face=Verdana,Arial,Helvetica,sans-serif size=2&gt;Having got past the last hurdle I then had a need for getting a list of all the site users into a Drop Down list which has spawned &lt;A href="http://blogs.vbcity.com/skullcrusher/articles/7736.aspx"&gt;this second article&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;/DIV&gt;&lt;img src ="http://blogs.vbcity.com/skullcrusher/aggbug/7733.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Andy Bonner</dc:creator><title>Get the Full user name in web hosted InfoPath Form</title><link>http://blogs.vbcity.com/skullcrusher/archive/2006/12/18/7634.aspx</link><pubDate>Mon, 18 Dec 2006 12:36:00 GMT</pubDate><guid>http://blogs.vbcity.com/skullcrusher/archive/2006/12/18/7634.aspx</guid><wfw:comment>http://blogs.vbcity.com/skullcrusher/comments/7634.aspx</wfw:comment><comments>http://blogs.vbcity.com/skullcrusher/archive/2006/12/18/7634.aspx#Feedback</comments><slash:comments>29</slash:comments><wfw:commentRss>http://blogs.vbcity.com/skullcrusher/comments/commentRss/7634.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/skullcrusher/services/trackbacks/7634.aspx</trackback:ping><description>&lt;P&gt;&lt;FONT face=Verdana&gt;I had the need the other day to get hold of a users full name within a web hosted InfoPath form and although I could easily get hold of the login name I couldn't get hold of the users full name.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana&gt;After some playing around I came up with the method I describe in &lt;A href="http://blogs.vbcity.com/skullcrusher/articles/7734.aspx"&gt;this article&lt;/A&gt;&amp;nbsp;which I hope someone else will find useful&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/skullcrusher/aggbug/7634.aspx" width = "1" height = "1" /&gt;</description></item></channel></rss>