I want to submit a hidden form when a value is entered into a text input field that is part of another form.
Label
I want to submit the value of "label" when I click on the Create button that submits TDISLabelForm. How can this be done?
Thanks for your help.
解决方案
function submitLable(lblval){
var payLoad = document.forms['TDISLabelForm']
.lab_no.value = document.forms['ackForm']
.label.value; // pass the value for visible for to the hidden form
var request = requestObject();
request.open("POST", "/createLabelTDIS.do", false); // post the value to createLabelTDIS.do for further processing as usual.
request.send(payLoad);
}
function requestObject() {
if (window.XMLHttpRequest)
return new XMLHttpRequest();
else if (window.ActiveXObject)
return new ActiveXObject("Msxml2.XMLHTTP");
else
throw new Error("Could not create HTTP request object");
}