Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
1080 มุมมอง

Hi. I'm adding a select for the request_rma view and it works but it doesn't make it mandatory. I'm trying to add required="", required="true" or required="required", as usually in html. Is something different to make this in odoo?


select required="required" name="tag_ids" class="form-control o_website_form_select">
option>---/option>
    t t-foreach="request.env['rma.tag'].sudo().search([], order='id asc')" t-as="tag">
        option t-att-value="tag.id">
​ ​t t-esc="tag.name"/>
​​/option>
/t>
/select>

UPDATE: As I can see, if I use option>---/option> instead of a void text it works but I get a generic error message "An error has occured, the form has not been sent" so it doesn't seem the correct solution. This message is no elegant at all to the user.
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด
required="True"

Try like this. T must be capital.

อวตาร
ละทิ้ง
ผู้เขียน

I used required="" because the other fields in the form were in this way. However, if I use required="True" nothing changes.

I tested more and the problem is not what to put inside required="", is that if the option has no text it doesn't evaluate it and continues. I jus tried and if i put <option>---</option> then I get the error message "An error has occured, the form has not been sent.". If I choose an option then the form is sended fine.

So, can I put an empty option (with no text and no value) in any way? Because it's not elegant see this kind of error.

คำตอบที่ดีที่สุด

I test when adding select field in website editor, they add required="1" so you should try that

อวตาร
ละทิ้ง
ผู้เขียน

I tried required="1" too and nothing changes.

As I said to @Aravind S, I tested more and the problem is not what to put inside required="", is that if the option has no text it doesn't evaluate it and continues. I jus tried and if i put <option>---</option> then I get the error message "An error has occured, the form has not been sent.". If I choose an option then the form is sended fine.

So, can I put an empty option (with no text and no value) in any way? Because it's not elegant see this kind of error.

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มี.ค. 23
207
1
ก.ย. 24
3601
1
ส.ค. 22
6195
0
ก.ค. 20
2663
1
มี.ค. 15
2825