Commit 4698bb02 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Fix for the sites array, which was not getting turned into a proper

array inside of the formfields array.
parent cf12fb1d
...@@ -522,6 +522,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt, ...@@ -522,6 +522,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt,
{ {
// Current form contents as formfields array. // Current form contents as formfields array.
var formfields = {}; var formfields = {};
var sites = {};
var rpc_callback = function(json) { var rpc_callback = function(json) {
console.info(json); console.info(json);
...@@ -532,8 +533,22 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt, ...@@ -532,8 +533,22 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt,
// form handler pages expect. // form handler pages expect.
var fields = $('.step-forms').serializeArray(); var fields = $('.step-forms').serializeArray();
$.each(fields, function(i, field) { $.each(fields, function(i, field) {
formfields[field.name] = field.value; /*
* The sites array is special since we want that to be
* an array inside of the formfields array, and serialize
* is not going to do that for us.
*/
var site = /^sites\[(.*)\]$/g.exec(field.name);
if (site) {
sites[site[1]] = field.value;
}
else {
formfields[field.name] = field.value;
}
}); });
if (Object.keys(sites).length) {
formfields["sites"] = sites;
}
console.info(formfields); console.info(formfields);
var xmlthing = sup.CallServerMethod(null, "instantiate", var xmlthing = sup.CallServerMethod(null, "instantiate",
(checkonly ? (checkonly ?
...@@ -898,7 +913,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt, ...@@ -898,7 +913,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt,
" Site " + siteid + " Cluster:</a>" + " Site " + siteid + " Cluster:</a>" +
" </label> " + " </label> " +
" <div class='col-sm-6'>" + " <div class='col-sm-6'>" +
" <select name=\"formfields[sites][" + siteid + "]\"" + " <select name=\"sites[" + siteid + "]\"" +
" class='form-control'>" + " class='form-control'>" +
" <option value=''>Please Select</option>" + " <option value=''>Please Select</option>" +
options + options +
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment