콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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.

관련 게시물 답글 화면 활동
0
3월 23
207
1
9월 24
3515
1
8월 22
6033
0
7월 20
2605
1
3월 15
2766