1, the problem leads to:
We often need to use Ajax in JS to send the request in the background, before we need to collect the required form form parameters, I often this solution, simple and convenient:
Editbasicdataobjectform is the form of the id,data forms of Name1=val1&name2=val2&name3=val3&
var data = $ ("#editBasicDataObjectForm"). Serialize ();
But I got stuck when I needed to get the field value of the radio type in the form once.
After a variety of inspection, finally have the results.
2. Solve the problem:
2.1 editbasicdataobjectform.jsp:
<div calss= "Baselinetype" >
<div class= "baselinetypelable" >
<label> Baseline Type:</albel>
</div>
<div class= "Baselinetypevalue" >
<input type= "Radio" name= "Baselinetype" id= " BaselineType1 "value=" 1 "/> non-baseline <input type=" Radio "
name=" Baselinetype "id=" BaselineType2 "value=" 2 "/> Functional baseline
<input type= "Radio" name= "Baselinetype" id= "BaselineType3" value= "3"/> Assign baseline
</div>
</div>
2.2 Basicdataobjectoperator.js:
var Baselinetype;
var baselinetypehtmlcol = document.geteementsbyname ("Baselinetype");
for (var i = 0; I < Baselinetypehtmlcol.length; I + +)
{
If (baselinetypehtmlcol[i].checked)
{
baselinetype = baselinetypehtmlcol[i].value;
}
}
..................
Baselinetype is the value we need. N_n
Above this JS to get the value of the radio type in the JSP form simple example is a small series to share all the content, hope to give you a reference, but also hope that we support cloud habitat community.