<?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>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Selecting Value of Drop Down</title><link>https://www.infopathdev.com:443/forums/thread/10314.aspx</link><pubDate>Fri, 18 Aug 2006 15:45:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:10314</guid><dc:creator>skrile</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/10314.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=10314</wfw:commentRss><description>Oof.  OK, I've managed to capture the data, but now I can't set the value of my dropdown.  Here is how I got the data:&lt;br /&gt;&lt;br /&gt;	var objEmployee = XDocument.GetDOM("viw_EmployeeSummary");&lt;br /&gt;	objEmployee.setProperty("SelectionNamespaces",'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" ' + ' xmlns:d="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"');&lt;br /&gt;	var objFound = objEmployee.selectSingleNode("//dfs:myFields/dfs:dataFields/d:viw_EmployeeSummary");&lt;br /&gt;var facID = objFound.selectSingleNode("@FacilityID").text;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Phew.  That gives me the facID (I only can get one record returned due to the nature of the query that populated "viw_EmployeeSummary").  So, now I want the value of a drop down to reflect the Facility Attribute (FacilityID) in the viw_EmployeeSummary results.  And this officially does not work:&lt;br /&gt;&lt;br /&gt;XDocument.DOM.SelectSingleNode("/my:myFields/my:CoordinatorAssessment/my:CoordinatorContact/my:Facility") = facID&lt;br /&gt;&lt;br /&gt;I'm guessing this doesn't work because it is just dealing with the DOM and is not effecting the actual drop down control, but I actually have no idea....&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So, to abstract my question a little.  How do you set the value of a drop down in an onClick event?</description></item><item><title>Re: Selecting Value of Drop Down</title><link>https://www.infopathdev.com:443/forums/thread/10313.aspx</link><pubDate>Fri, 18 Aug 2006 14:38:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:10313</guid><dc:creator>skrile</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/10313.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=10313</wfw:commentRss><description>Well, it turns out just &lt;u&gt;getting &lt;/u&gt;the value is a bit tricky in the onClick event.  I've tried something like this:&lt;br /&gt;&lt;br /&gt;var facID = XDocument.GetDOM("FacilityCoordinators").SelectSingleNode("dfs:myFields/dfs:dataFields/d:Facility/FacilityID");&lt;br /&gt;&lt;br /&gt;But keep getting jscript errors ("Object does not support this property or method").  FacilityCoordinators is a secondary data connection that pulls data from a SQL query.  Anyone out there see what I've got wrong here?</description></item><item><title>Re: Selecting Value of Drop Down</title><link>https://www.infopathdev.com:443/forums/thread/10312.aspx</link><pubDate>Thu, 17 Aug 2006 15:49:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:10312</guid><dc:creator>skrile</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/10312.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=10312</wfw:commentRss><description>Right.  So, what is the syntax to set the value of this.  Here is the code I have so far:&lt;br /&gt;&lt;br /&gt;function CTRL270_5::OnClick(eventObj)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;	var thisUserName = XDocument.DOM.selectSingleNode("/my:myFields/my:InitiatorInformation/my:UserName").text;&lt;br /&gt;	var thisUserDomain = XDocument.DOM.selectSingleNode("/my:myFields/my:InitiatorInformation/my:UserDomain").text;&lt;br /&gt;	var thisNetworkID = thisUserDomain + "\\" + thisUserName;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;	if(thisUserName=="") &lt;br /&gt;		{&lt;br /&gt;			XDocument.UI.Alert("You must enter your current Network User Name.");&lt;br /&gt;		}&lt;br /&gt;	else &lt;br /&gt;		{&lt;br /&gt;			// get the data adapter object&lt;br /&gt;			myDataAdapter = XDocument.DataAdapters("viw_EmployeeSummary"); &lt;br /&gt;&lt;br /&gt;			// set the SQL command property of the data adapter, providing a dynamic WHERE clause&lt;br /&gt;			myDataAdapter.Command = "select * from viw_EmployeeSummary WHERE NetworkID LIKE '" + thisNetworkID + "'";&lt;br /&gt;			&lt;br /&gt;			// execute the query&lt;br /&gt;			myDataAdapter.Query();&lt;br /&gt;		}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;I'm guessing I'd set the value in the {else} portion of my logic.  I just can't seem to find the right syntax to properly set the value of a drop down.</description></item><item><title>Re: Selecting Value of Drop Down</title><link>https://www.infopathdev.com:443/forums/thread/10311.aspx</link><pubDate>Thu, 17 Aug 2006 15:46:06 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:10311</guid><dc:creator>Shiraz Cupala</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/10311.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=10311</wfw:commentRss><description>Ah ok.  I didn't realize your dropdown is bound to your secondary data source.&lt;br /&gt;&lt;br /&gt;It sounds like you need to move all this into code since you want to build the SQL query on the fly at a specific point.  In code then you can manually set the value of the dropdown secondary DOM node as needed.  Trying to mix in rules in this instance may be more trouble than it's worth given the order of event firing.</description></item><item><title>Re: Selecting Value of Drop Down</title><link>https://www.infopathdev.com:443/forums/thread/10310.aspx</link><pubDate>Thu, 17 Aug 2006 15:37:56 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:10310</guid><dc:creator>skrile</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/10310.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=10310</wfw:commentRss><description>Hmmm.  Neither of these things seem to have helped.  My drop-down is bound to a Secondary Data Source, so all of the nodes have a little lock icon on them and the default value section is grayed out.&lt;br /&gt;&lt;br /&gt;I guess I'm not following your second point.  I have a SQL connection to an Employee table.  I am using the OnClick event on my button to build a query statement based on values a user would put in to the form.  I then execute the Query with values given by the user to return a row of information.  That row contains a value that I want to set my drop down to.  Does that make sense?</description></item><item><title>Re: Selecting Value of Drop Down</title><link>https://www.infopathdev.com:443/forums/thread/10309.aspx</link><pubDate>Thu, 17 Aug 2006 15:27:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:10309</guid><dc:creator>Shiraz Cupala</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/10309.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=10309</wfw:commentRss><description>Actually, you can set the default value for a dropdown that uses a lookup for its values but it's not obvious.  What you have to do is set the default value in the node itself in the Data Source Pane.  Go there and double-click the node to which your dropdown is bound.  There you can type in the default value.   You have to be careful that the value is in your set of allowed values.&lt;br /&gt;&lt;br /&gt;Second, correct rules execute first, then code.  What you can do is set your query parameters via rules directly into the secondary data source query parameters nodes.  Then execute the query using rules.  This might help work around your issue.</description></item><item><title>Selecting Value of Drop Down</title><link>https://www.infopathdev.com:443/forums/thread/5788.aspx</link><pubDate>Thu, 17 Aug 2006 12:59:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:5788</guid><dc:creator>skrile</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/5788.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=5788</wfw:commentRss><description>I've seen several iterations of this issue here, but can't seem to get any satisfaction in my form :).  &lt;br /&gt;&lt;br /&gt;I am trying to set the value of a drop down.  I can get it to work...sort of.&lt;br /&gt;&lt;br /&gt;At the top of my form, I have a NetworkID section that allows users to plug in their NetworkID.  When they click a button, I use jscript in the OnClick event to perform a query on a secondary data source.  If values are found corresponding to the network id, they are used to populate several text fields in the form below.  Now, this is pretty straightforward - I set the default values of the text fields to the secondary data source.&lt;br /&gt;&lt;br /&gt;However, of course, drop downs don't have default values.  So, when the button is clicked, the query is fired, and the fields update but the drop down doesn't.  So, I set up a rule on the button that sets the value of the drop down equal to the corresponding value of the secondary data source.&lt;br /&gt;&lt;br /&gt;If I click the button twice, the drop down is reset as expected to the matching value.  I'm guessing this is an order-of-operation thing.  In other words, the rule is fired, then the OnClick event occurs.  Is there any way to run the query first (oh and I need to pass parameters to the query, so making a rule to run the query won't work because you can't paramaterize within a rule)?</description></item></channel></rss>