Hi,
First off I am "Brand New" to InfoPath and its scripting please help!!
I have a standard InfoPath form with fields and a few Drop-down lists populated by a SQL database.
What I want to do is submit all of the selected data to a stored procedure in my database which will update a table.
I am having problems with getting my values submitted, firstly I could not get it to read the current value of my drop-down list, so I added an extra field for every dropdown, which is hidden and have a couple of rules, these fields always have the current value of the drop-down, but moment when I submit it I get the following error message: Object Required.
I am thinking maybe my XPath synntax is wrong but I dont know???
Here is the code of the Submit button:
function CTRL18_7::OnClick(eventObj)
{
//Retrieve the value of the field that you want to use as a parameter
//to the stored procedure.
var emh_rr_no = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:hose_info/@emh_rr_no").text;
var received_name = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:hose_info/@received_name").text;
var hose_part_no = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:hose_info/@hose_part_no").text;
var overall_length = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:hose_info/@overall_length").text;
var Machine = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:hose_info/@Machine").text;
var hose_type = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:hose_info/@Hose").text;
var condition_desc = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:hose_info/@Condition").text;
var origin_desc = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:hose_info/@Origin").text;
var first_fitting_type = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:hose_info/@FittingA").text;
var second_fitting_type = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:hose_info/@secondFitting").text;
var adapter_type = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:hose_info/@Adapter").text;
var comment = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:hose_info/@comment").text;
//Set the Command for the Query Adapter of the Data Source. Incorporate the
//parameter values that you want to use.
XDocument.QueryAdapter.Command = "execute add_hose_info " + "'" + emh_rr_no + "',"+"'"+received_name+"',"+"'"+hose_part_no+"',"+"'"+overall_length+"',"+"'"+machine_type+"',"+"'"+hose_type+"',"+"'"+condition_desc+"',"+"'"+origin_desc+"',"+"'"+first_fitting_type+"',"+"'"+second_fitting_type+"',"+"'"+adapter_type+"',"+"'"+comment+"'";
//Query the Data Source.
XDocument.Query();
}
Thanks