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

Hi All,

I have create a webform where I'll get 10 inputs for the customer and want to make first 5 input fields to be mandetory and other 5 is optional.



I'm trying to do with a-ttf-class but is not working.



can anyone help me on this?

아바타
취소
베스트 답변

Please try this one...
t-attf-class="form-control {{ 'required' if i <= 5 else '' }}"
Thanks & Regards

아바타
취소
작성자

Not working
I'm asking v17

I have tried it in v17
this above is for only adding your class "clsrequired" for first 5 field

if you want to add required attribute for first 5 field then you have to try below code
<t t-if="i &lt;= 5">
<div class="form-group">
<input type="text" t-attf-id="field_#{i}"
class="form-control"
required="1"/>
</div>
</t>
<t t-else="">
<div class="form-group">
<input type="text" t-attf-id="field_#{i}"
class="form-control"/>
</div>
</t>

Thanks & regards

작성자

Thanks Yatrik

관련 게시물 답글 화면 활동
0
1월 22
2469
1
3월 25
1342
0
11월 24
1526
0
6월 24
1567
1
6월 24
2078