สอบ ถามครับ ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ สอบถาม Qweb Odoo

HTML Basic
สำหรับนักพัฒนาเว็บไซต์มือใหม่ HTML , CSS และการใช้ Tools ต่างๆ ในการพัฒนาเว็บไซต์

Moderator: mindphp

ภาพประจำตัวสมาชิก
chatee supasand
PHP VIP Members
PHP VIP Members
โพสต์: 1666
ลงทะเบียนเมื่อ: 04/06/2019 10:06 am

สอบ ถามครับ ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ สอบถาม Qweb Odoo

โพสต์ที่ยังไม่ได้อ่าน โดย chatee supasand »

ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ

โค้ด: เลือกทั้งหมด

<p><span><input type="checkbox" />Quotation(RFQ) </span></p>
โดยตอนนี้ผมรับค่ามาจากระบบ มันได้ค่าเป็น True ออกมา

โค้ด: เลือกทั้งหมด

t-field = "o.quotation"
คือผมต้องการ ทำ เช็ค if ให้มันถ้า มีค่า เป็น True ให้ทำการเพิ่ม checked ในเท็ค input เพื่อให้มันติ้กถูก ไม่ทราบว่าต้องเขียน
if ยังไงบ้างครับ
รูปภาพ
ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

Re: สอบ ถามครับ ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

เอา code เต็ม
t-field = "o.quotation" ใส่ไปอย่างไง
ต้องการผลอย่างไร
ภาพประจำตัวสมาชิก
chatee supasand
PHP VIP Members
PHP VIP Members
โพสต์: 1666
ลงทะเบียนเมื่อ: 04/06/2019 10:06 am

Re: สอบ ถามครับ ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ

โพสต์ที่ยังไม่ได้อ่าน โดย chatee supasand »

thatsawan เขียน:เอา code เต็ม
t-field = "o.quotation" ใส่ไปอย่างไง
ต้องการผลอย่างไร
code check box

โค้ด: เลือกทั้งหมด

<td><p><span><input type="checkbox"/>Quotation(RFQ)</span></p></td>
ผลที่ต้องการ คือให้มัน check ตามภาพได้ล่าง
cb.png
cb.png (3.16 KiB) Viewed 1817 times
รูปภาพ
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41251
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Re: สอบ ถามครับ ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

ลองดูตัวอย่างที่ สองของโพส นี้
https://www.mindphp.com/forums/viewtopic ... 014#p25014

โค้ด: เลือกทั้งหมด

checked="checked"
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

Re: สอบ ถามครับ ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ สอบถาม Qweb Odoo

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

โค้ด: เลือกทั้งหมด

<t t-if="o.quotation" == 1>
                 <input  checked="checked" type="checkbox"/>                      
   </t>

โค้ด: เลือกทั้งหมด

<t t-if="o.quotation" == 0>
                 <input   type="checkbox"/>                      
   </t>
หรือจะใช้ if else

โค้ด: เลือกทั้งหมด

<span class="d-inline-block text-center o_thread_tooltip_snailmail">
            <t t-if="status === 'sent'">
                <i class='fa fa-check o_thread_tooltip_snailmail_icon' title="Sent" role="img" aria-label="Sent"/>
                Sent
            </t>
            <t t-elif="status === 'canceled'">
                <i class='fa fa-trash-o o_thread_tooltip_snailmail_icon' title="Canceled" role="img" aria-label="Canceled"/>
                Canceled
            </t>
            <t t-elif="status === 'pending'">
                <i class='fa fa-clock-o o_thread_tooltip_snailmail_icon' title="Awaiting Dispatch" role="img" aria-label="Awaiting Dispatch"/>
                Awaiting Dispatch
            </t>
            <t t-else="">
                <i class='fa fa-exclamation text-danger o_thread_tooltip_snailmail_icon' title="Error" role="img" aria-label="Error"/>
                Error
            </t>
        </span>
ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

Re: สอบ ถามครับ ทำเซ็ค if ให้ทำการ checkbox ยังไงครับ สอบถาม Qweb Odoo

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

ทำวิธีไหนเเจ้งด้วยค่ะ
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 95