I'm having a problem posting a form and was wondering if anyone here could help.
I have a form that has a user control inside of it, this user control will prompt for two dates, but the user has to be able to add as many date ranges as they want. So when they click the "Add" button, this code gets executed to generate the two textboxes. This is just one to make it easier to read:
var newSDTB = document.createElement('input');
newSDTB.id = this._count;
newSDTB.setAttribute('type', 'text');
newSDTB.setAttribute('name', 'startDateParameter' + this._count);
newDiv.appendChild(newSDTB);
var SDTB = Atms.Reporting.MultiDate.createTB("dstartDate", newSDTB);
SDTB.onChange = function() { Atms.Dojo.adjustEndDate("dstartDate" + tCount, "dendDate" + tCount); };
createTB: function(type, tb) {
return new dijit.form.DateTextBox({
'id': type + this._textboxCount,
'constraints': { min: '1995-01-01', max: '2100-12-31' },
'required': true,
'trim': true,
'promptMessage': "mm / dd / yyyy",
'invalidMessage': "Invalid date. Use mm/dd/yyyy format."
}, tb);
},
newSDTB.id = this._count;
newSDTB.setAttribute('type', 'text');
newSDTB.setAttribute('name', 'startDateParameter' + this._count);
newDiv.appendChild(newSDTB);
var SDTB = Atms.Reporting.MultiDate.createTB("dstartDate", newSDTB);
SDTB.onChange = function() { Atms.Dojo.adjustEndDate("dstartDate" + tCount, "dendDate" + tCount); };
createTB: function(type, tb) {
return new dijit.form.DateTextBox({
'id': type + this._textboxCount,
'constraints': { min: '1995-01-01', max: '2100-12-31' },
'required': true,
'trim': true,
'promptMessage': "mm / dd / yyyy",
'invalidMessage': "Invalid date. Use mm/dd/yyyy format."
}, tb);
},
Now all of this works fine I believe, the textbox shows up as it should and the on change event fires correctly.
However when they click save, any generated fields do not show up in the post. Only dates that were put in textboxes that existed on load are posted.
This is the code used:
post: function(form, onSuccess, onFailure) {
form = Atms.Dom.getById(form);
if (!form.validate || form.validate()) {
dojo.xhrPost({
url: form.action,
load: function(response, ioArgs) {
if (onSuccess) onSuccess(response);
return response;
},
error: function(response, ioArgs) {
if (onFailure) onSuccess(response);
return response;
},
form: form.id
});
} else {
alert('Please fill out all required fields');
}
},
form = Atms.Dom.getById(form);
if (!form.validate || form.validate()) {
dojo.xhrPost({
url: form.action,
load: function(response, ioArgs) {
if (onSuccess) onSuccess(response);
return response;
},
error: function(response, ioArgs) {
if (onFailure) onSuccess(response);
return response;
},
form: form.id
});
} else {
alert('Please fill out all required fields');
}
},
Does anyone know why the generated fields are not being submitted properly? Thanks.
