<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Changing field value in JScript</title><link>https://www.infopathdev.com:443/forums/thread/24631.aspx</link><pubDate>Wed, 21 Nov 2007 19:59:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:24631</guid><dc:creator>10basetom</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/24631.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=24631</wfw:commentRss><description>Hi Matt,

Thanks for the correction. In fact, my solution involved something similar (writing to eventObj.Site.text). I&amp;#39;ll edit my post to reflect this.

Tom</description></item><item><title>Re: Changing field value in JScript</title><link>https://www.infopathdev.com:443/forums/thread/24618.aspx</link><pubDate>Wed, 21 Nov 2007 16:25:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:24618</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/24618.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=24618</wfw:commentRss><description>&lt;p&gt;Hi 10basetom,&lt;/p&gt;
&lt;p&gt;Looks like you got it working... grats!&amp;nbsp; Are you sure eventObj.Source.text is read-only?&lt;/p&gt;</description></item><item><title>Changing field value in JScript</title><link>https://www.infopathdev.com:443/forums/thread/24412.aspx</link><pubDate>Wed, 14 Nov 2007 04:04:05 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:24412</guid><dc:creator>10basetom</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/24412.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=24412</wfw:commentRss><description>Hello,&lt;br /&gt;&lt;br /&gt;

I have a field named FirstName that has an OnAfterChange event handler. In this event handler I would like to make sure that the FirstName value is in sentence casing (i.e., &amp;quot;tom&amp;quot; or &amp;quot;TOM&amp;quot; would be corrected to &amp;quot;Tom&amp;quot;). My question is, what is the best way to update the FirstName field with the corrected value?&lt;br /&gt;&lt;br /&gt;

I know that I can just change &lt;code&gt;XDocument.DOM.selectSingleNode(&amp;quot;my:myFields/my:FirstName&amp;quot;).text&lt;/code&gt;, but is there another way to do this that doesn&amp;#39;t require knowing the XPath? What I have in mind is to change a property equivalent to eventObj.Site.text or eventObj.NewValue.&lt;br /&gt;&lt;br /&gt;

Thanks,&lt;br /&gt;
Tom&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;UPDATE:&lt;/b&gt; After further research I found out that I needed to set a Boolean flag in order to prevent infinite loops in the OnAfterChange event handler (thanks to Greg Collins&amp;#39; &lt;a href="http://www.infopathdev.com/blogs/greg/archive/2004/07/07/Avoid-an-Endless-Loop-During-Event-Bubbling.aspx"&gt;article&lt;/a&gt;). Now I can change the field value by updating either &lt;code&gt;XDocument.DOM.selectSingleNode(eventObj.MatchExpression).text&lt;/code&gt; or &lt;code&gt;eventObj.Site.text&lt;/code&gt;.</description></item></channel></rss>