html form表单提交

前要:利用themleaf模板使用th:checked提交数据怎么选择都是on 奇怪的很,只好回去使用原来的form表单提交了

重新测试了一遍发现只能必须只能写name 而不是在div radio的范围内部写th:field="*{serviceAttitudeScore}",也不能单独写载label里面,仅仅支持name提交表单!!!!! value可以两种写法(th:value/value)

对于themleaf都可以提交,提交属性是name或者th:field,但是对于radio是name 而不是th:field!!!!!!!!!!

头部

  <form id="form1" action="#" th:action="@{/workflow/worksheetEdit/create}"
                      method="post" class="box-body-content" th:object="${worksheetEditVo}"
                      enctype="multipart/form-data" role="form">


 <div class="radioBox" >
                                    <label><input type="radio" name="serviceAttitudeScore" value="5">很满意 5分</label>
                                    <label><input type="radio" name="serviceAttitudeScore" value="4">满意 4分</label>
                                    <label><input type="radio" name="serviceAttitudeScore" value="3">尚可 3分</label>
                                    <!--<label><input type="radio" name="attitude">不满意 2分</label>-->
                                    <!--<label><input type="radio" name=attitude">投诉 1分</label>-->
                                </div>

name只要对应类的字段利用submit提交即可,主要是提价必须在表单内部,不然不知道提交的是什么

 <div class="box-footer">
                        <button type="submit" class="btn btn-sure" >保存</button>
                    </div>
                </form>

猜你喜欢

转载自blog.csdn.net/sicily_winner/article/details/80028817