表单的代码:<groupbox style="padding:20px; width: 300;" flex="0">
<caption><label>著录信息输入</label></caption>
<hbox id="queryform">
textboxes
<grid flex="0">
<columns>
<column /> <column />
</columns>
<rows>
<row>
<label value="申请号" id="M_APPLY_NO_check"/>
<textbox id="MApplyNo" />
</row>
<row>
<label value="主分类号" id="M_CLASS_check" />
<textbox id="M_MAIN_CLASS" />
</row>
<row>
<label value="次分类号" id="M_MAIN_CLASS_check"/>
<textbox id="M_CLASS" />
</row>
<row>
<label id="M_OPEN_NO_check" value="公告号" />
<textbox id="M_OPEN_NO" />
</row>
<row>
<label id="M_NAME_check" value="产品名称" />
<textbox id="M_NAME" />
</row>
<row>
<label id="M_APPLY_MAN_check" value="申请人" />
<textbox id="M_APPLY_MAN" />
</row>
<row>
<label id="M_ADDRESS_check" value="申请地址" />
<textbox id="M_ADDRESS" />
</row>
<row>
<label id="M_AGENT_check" value="代理机构" />
<textbox id="M_AGENT" />
</row>
<row>
<label id="M_FACTOR_check" value="代理人" />
<textbox id="M_FACTOR" />
</row>
<row>
<label id="M_DESIGN_MAN_check" value="设计人" />
<textbox id="M_DESIGN_MAN" />
</row>
<row>
<label id="M_COUNTRY_check" value="申请人国家" />
<textbox id="M_COUNTRY" />
</row>
<row>
<label id="M_AG_ADDRESS_check" value="代理机构地址" />
<textbox id="M_AG_ADDRESS" />
</row>
<row>
<label id="M_ADDRESS2_check" value="联系人地址" />
<textbox data_type="text" id="M_ADDRESS2" />
</row>
<row>
<label id="M_AG_PHONE_check" value="代理机构电话" />
<textbox id="M_AG_PHONE" />
</row>
<row>
<label id="M_PHONE_check" value="联系人电话" />
<textbox id="M_PHONE" width="300"/>
</row>
<row>
<label id="M_CD_NO_check" value="光盘号" />
<textbox id="M_CD_NO" />
</row>
<row>
<label id="M_PRIORITY_check" value="优先权" />
<textbox id="M_PRIORITY" />
</row>
<row>
<label id="M_OLD_NO_check" value="分案申请号" />
<textbox id="M_OLD_NO" />
</row>
<row>
<label id="M_REMARK_check" value="简要说明" />
<textbox multiline="false" id="M_REMARK" />
</row>
</rows>
</grid>
</hbox>
<hbox style="padding-left: 700px;">
<button label="提交" oncommand="submit();" />
</hbox>
</groupbox>
js方法submit :function submit(){
try{
var textInfo = getPatentTextInfo();
getRequestTextString(textInfo);
getRequestImageString(imageInfo);
xmlHttp = new XMLHttpRequest();
xmlHttp.open("POST", serverpath + "OutsideImport", true);
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.setRequestHeader("Accept", "*/*, text/xml");
xmlHttp.setRequestHeader("Content-type", "multipart/form-data; boundary=" + boundaryString);
xmlHttp.setRequestHeader("Content-length", multiStream.available());
xmlHttp.send(multiStream);
//xmlHttp.send();
}catch(e){
alert(e);
}
}
getPatentTextInfo():方法:
function getPatentTextInfo(){
var flag=false;
var elem = document.getElementById("queryform");
var items = new Array();
var textValue = elem.getElementsByTagName("textbox");
for(var i = 0; i < textValue.length; i++){
var id=textValue[i].getAttribute("id");
var value = document.getElementById(id).value;
if(value != "" && value != null){
var len=items.length;
items[len]=new Array();
items[len][0]=id;
items[len][1]=value;
}
}
alert(items);
return items;
}
getRequestTextString()方法:
function getRequestTextString(textArray){
var requestBody = '';
var patentInfoInputStream = Components.classes["@mozilla.org/io/string-input-stream;1"].createInstance(Components.interfaces.nsIStringInputStream);
for(var i = 0; i < textArray.length; i++){
requestBody = requestBody + boundary + '\r\n'
+ 'Content-Disposition: form-data; name="'+ textArray[i][0] +'"' + '\r\n'
+ '\r\n'
+ encodeURI(textArray[i][1]) + '\r\n';
}
patentInfoInputStream.setData(requestBody, requestBody.length);
alert(requestBody);
multiStream.appendStream(patentInfoInputStream);
}
前台是这样,我现在不清楚action中如何接收表单里的值?忘高手指点一下。刚接触xul