Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
4324 Lượt xem

 <select class="form-control text-uppercase rounded-0" name="x_brand"     required="required" t-att-value="request.params.get('x_brand', '')">
                    <option value=""></option>
                    <option value="A">A</option>
                    <option value="B">B</option>
                    <option value="C"></option>
                </select>


I have the above code on website contact form, but even if the <select> tag is required, it is possible to submit the form with the field empy (on all the other fields, also other <select>, the required is working as expected). The submit metod is the following:


<div class="form-group">
          <div class="col-md-offset-3 col-sm-offset-4 col-sm-8 col-md-7">
            <span class="btn  btn-md o_website_form_send" style="background-color:             #127749; color:#fff;">Invia</span>
            <span id="o_website_form_result"/>
          </div>
        </div>



Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

I face the same issue in Odoo 17.

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Hello Ray,

thanks for your replay, but the field you posted is <input type="text"> and this is working also on my side.


The issue is with <select> type

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

If you take a look at the CONTACT US form on the website, you will see this, which you can compare to what you are trying:

 <div class="form-group row form-field o_website_form_required">
   <label class="col-lg-3 col-md-4 col-form-label" 
for="contact_name">Your Name</label> <div class="col-lg-7 col-md-8"> <input type="text" class="form-control o_website_form_input"
name="contact_name" t-att-value="request.params.get('contact_name', '')"
required=""/> </div> </div>
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 10 19
2276
1
thg 12 22
3900
1
thg 6 20
6120
2
thg 4 19
6410
1
thg 8 18
8054