SlideShare a Scribd company logo
An Overview of Owl Input
Bindings in Odoo 16
Enterprise
Introduction
Enterprise
The Odoo Javascript framework uses a custom component framework
called Owl(Odoo Web Library). Odoo 16 uses relies on the OWL for web
development. It employs OWL concepts and principles in its POS system,
with JavaScript code.
In Odoo 16, Owl Input Bindings are a powerful feature that streamlines
the development of interactive forms. It makes the Owl framework to
establish a direct connection between data and user interface (UI)
elements. That is, we can bind data from our Odoo models to input fields
(text, numbers, dropdowns, etc.) and buttons within our templates,
enabling real-time updates and a more responsive user experience.
Enterprise
The requirement to read the value from an HTML input (or textarea,
or select) is extremely typical in order to use it (note: it is not required
to be in a form).
class Form extends owl.Component {
state = useState({ text: "" });
_updateInputValue(event) {
this.state.text = event.target.value;
}
}
<div>
<input t-on-input="_updateInputValue" />
<span t-esc="state.text" />
</div>
Enterprise
Also in OWL framework, t-model is a powerful directive that provides
two-way data binding between an input element and a component's
state. This means that any changes made to the input element will
automatically update the state, and any changes to the state will
update the input element. We may create shorter code instead the
previous example using the t-model directive.
class Form extends owl.Component {
state = { text: "" };
}
<div>
<input t-model="state.text" />
<span t-esc="state.text" />
</div>
Enterprise
But, the code differs slightly if you have to use a checkbox, radio
button, or select tags. In this case, OWL uses t-model directive which
binds the input element to the inputValue property in the
component's state.
For example, for a group of radio buttons with same name (Here,
either any of them can be selected at a time)
<div>
<label for="colorRed">Red</label>
<input type="radio" id="colorRed" name="color" value="red" t-model="state.color"/>
<label for="colorBlue">Blue</label>
<input type="radio" id="colorBlue" name="color" value="blue" t-model="state.color"/>
</div>
Here, it binds the t-model to a data property in our component that
holds the selected value, here ‘state.color’
Enterprise
For another example, in the case of <select> tags,
<select t-model="selectedCountry">
<option value="">Select Country</option>
<option value="US">United States</option> <option
value="UK">United Kingdom</option>
</select>
selectedCountry can be the selected option value. The t-model
binds with the value provided as options for the select tag.
Enterprise
We can use modifiers with t-model for advanced behaviour such as
lazy updates, debouncing, trimming, etc
● t-model.lazy for Lazy Updates, meaning the data property is
only updated when the user explicitly submits the form. That is,
it updates the value on the change event (when the user
interacts with the UI element)
Additional Considerations:
<input type="text" t-model.lazy="name" />
● t-model.debounce delays the update of the bound data
property by a specified time (in milliseconds) after the user
stops typing.
<input type="text" t-model.debounce="500"="searchTerm" />
Enterprise
● t-model.trim for Trimming Input, meaning removes any
leading or trailing whitespace characters from the user's input
before updating the bound data property.
<input type="text" t-model.trim="username" />
<input type="text" t-model.number="quantity" />
● t-model.number for Parsing Numbers. It attempts to convert
the user's input into a numerical value before updating the
bound data property.
Enterprise
● We can combine multiple modifiers with t-model for even more
control. For instance, t-model.debounce.trim would debounce
user input and then trim any whitespace before updating the
data property.
In short, Owl Input Bindings in Odoo 16 offer a significant boost to
the development experience and the resulting user experience of our
interactive and dynamic forms with real-time updates, automatic
validation, and error handling.
For More Info.
Check our company website for related blogs
and Odoo book.
Check our YouTube channel for
functional and technical videos in Odoo.
Enterprise
www.cybrosys.com
Ad

More Related Content

Similar to An Overview of Owl Input Bindings in Odoo 16 (20)

Forms with html5 (1)
Forms with html5 (1)Forms with html5 (1)
Forms with html5 (1)
Anada Kale
 
Forms with html5
Forms with html5Forms with html5
Forms with html5
Suvarna Pappu
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
 
How To Extend Odoo Form View using js_class_
How To Extend Odoo Form View using js_class_How To Extend Odoo Form View using js_class_
How To Extend Odoo Form View using js_class_
Celine George
 
Exploring Angular 2 - Episode 2
Exploring Angular 2 - Episode 2Exploring Angular 2 - Episode 2
Exploring Angular 2 - Episode 2
Ahmed Moawad
 
html 5 new form attribute
html 5 new form attributehtml 5 new form attribute
html 5 new form attribute
Priyanka Rasal
 
Data weave
Data weaveData weave
Data weave
Adithya-kuchan
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
Ran Wahle
 
Data binding in Angular fully Explained .pptx
Data binding in Angular fully Explained .pptxData binding in Angular fully Explained .pptx
Data binding in Angular fully Explained .pptx
ExtraID8
 
How Owl.js Masterfully Blends React and Vue Awesomeness in odoo
How Owl.js Masterfully Blends React and Vue Awesomeness in odooHow Owl.js Masterfully Blends React and Vue Awesomeness in odoo
How Owl.js Masterfully Blends React and Vue Awesomeness in odoo
Celine George
 
Dataweave nagarjuna
Dataweave nagarjunaDataweave nagarjuna
Dataweave nagarjuna
Nagarjuna reddy
 
Data weave
Data weaveData weave
Data weave
manavp
 
Dataweave by nagarjuna
Dataweave  by nagarjunaDataweave  by nagarjuna
Dataweave by nagarjuna
Nagarjuna reddy
 
Knockoutjs databinding
Knockoutjs databindingKnockoutjs databinding
Knockoutjs databinding
Boulos Dib
 
Data weave
Data weave Data weave
Data weave
Khasim Saheb
 
Data weave
Data weave Data weave
Data weave
Khan625
 
Data weave
Data weave Data weave
Data weave
Anand kalla
 
Data weave
Data weave Data weave
Data weave
Sunil Komarapu
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
Nisa Soomro
 
]project-open[ Workflow Developer Tutorial Part 3
]project-open[ Workflow Developer Tutorial Part 3]project-open[ Workflow Developer Tutorial Part 3
]project-open[ Workflow Developer Tutorial Part 3
Klaus Hofeditz
 
Forms with html5 (1)
Forms with html5 (1)Forms with html5 (1)
Forms with html5 (1)
Anada Kale
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
 
How To Extend Odoo Form View using js_class_
How To Extend Odoo Form View using js_class_How To Extend Odoo Form View using js_class_
How To Extend Odoo Form View using js_class_
Celine George
 
Exploring Angular 2 - Episode 2
Exploring Angular 2 - Episode 2Exploring Angular 2 - Episode 2
Exploring Angular 2 - Episode 2
Ahmed Moawad
 
html 5 new form attribute
html 5 new form attributehtml 5 new form attribute
html 5 new form attribute
Priyanka Rasal
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
Ran Wahle
 
Data binding in Angular fully Explained .pptx
Data binding in Angular fully Explained .pptxData binding in Angular fully Explained .pptx
Data binding in Angular fully Explained .pptx
ExtraID8
 
How Owl.js Masterfully Blends React and Vue Awesomeness in odoo
How Owl.js Masterfully Blends React and Vue Awesomeness in odooHow Owl.js Masterfully Blends React and Vue Awesomeness in odoo
How Owl.js Masterfully Blends React and Vue Awesomeness in odoo
Celine George
 
Data weave
Data weaveData weave
Data weave
manavp
 
Knockoutjs databinding
Knockoutjs databindingKnockoutjs databinding
Knockoutjs databinding
Boulos Dib
 
Data weave
Data weave Data weave
Data weave
Khan625
 
]project-open[ Workflow Developer Tutorial Part 3
]project-open[ Workflow Developer Tutorial Part 3]project-open[ Workflow Developer Tutorial Part 3
]project-open[ Workflow Developer Tutorial Part 3
Klaus Hofeditz
 

More from Celine George (20)

Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18
Celine George
 
How to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 SalesHow to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 Sales
Celine George
 
How to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo SlidesHow to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo Slides
Celine George
 
How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18
Celine George
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
How to Manage a Customer Account in Odoo 17 Sales
How to Manage a Customer Account in Odoo 17 SalesHow to Manage a Customer Account in Odoo 17 Sales
How to Manage a Customer Account in Odoo 17 Sales
Celine George
 
How to Open a Wizard When Clicking on the Kanban Tile in Odoo 18
How to Open a Wizard When Clicking on the Kanban Tile in Odoo 18How to Open a Wizard When Clicking on the Kanban Tile in Odoo 18
How to Open a Wizard When Clicking on the Kanban Tile in Odoo 18
Celine George
 
Ledger Posting in odoo Continental Accounting
Ledger Posting in odoo Continental AccountingLedger Posting in odoo Continental Accounting
Ledger Posting in odoo Continental Accounting
Celine George
 
How to Create & Manage a New User Menu in Odoo 18
How to Create & Manage a New User Menu in Odoo 18How to Create & Manage a New User Menu in Odoo 18
How to Create & Manage a New User Menu in Odoo 18
Celine George
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18
Celine George
 
How to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 SalesHow to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 Sales
Celine George
 
How to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo SlidesHow to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo Slides
Celine George
 
How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18
Celine George
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
How to Manage a Customer Account in Odoo 17 Sales
How to Manage a Customer Account in Odoo 17 SalesHow to Manage a Customer Account in Odoo 17 Sales
How to Manage a Customer Account in Odoo 17 Sales
Celine George
 
How to Open a Wizard When Clicking on the Kanban Tile in Odoo 18
How to Open a Wizard When Clicking on the Kanban Tile in Odoo 18How to Open a Wizard When Clicking on the Kanban Tile in Odoo 18
How to Open a Wizard When Clicking on the Kanban Tile in Odoo 18
Celine George
 
Ledger Posting in odoo Continental Accounting
Ledger Posting in odoo Continental AccountingLedger Posting in odoo Continental Accounting
Ledger Posting in odoo Continental Accounting
Celine George
 
How to Create & Manage a New User Menu in Odoo 18
How to Create & Manage a New User Menu in Odoo 18How to Create & Manage a New User Menu in Odoo 18
How to Create & Manage a New User Menu in Odoo 18
Celine George
 
Ad

Recently uploaded (20)

Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
APM Midlands Region April 2025 Sacha Hind Circulated.pdf
APM Midlands Region April 2025 Sacha Hind Circulated.pdfAPM Midlands Region April 2025 Sacha Hind Circulated.pdf
APM Midlands Region April 2025 Sacha Hind Circulated.pdf
Association for Project Management
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
Political History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptxPolitical History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
"Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules""Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules"
rupalinirmalbpharm
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
 
Contact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: OptometryContact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: Optometry
MushahidRaza8
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Herbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptxHerbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptx
RAJU THENGE
 
Sugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptxSugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptx
Dr. Renu Jangid
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
Nguyen Thanh Tu Collection
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
"Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules""Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules"
rupalinirmalbpharm
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
 
Contact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: OptometryContact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: Optometry
MushahidRaza8
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Herbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptxHerbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptx
RAJU THENGE
 
Sugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptxSugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptx
Dr. Renu Jangid
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
Nguyen Thanh Tu Collection
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
Ad

An Overview of Owl Input Bindings in Odoo 16

  • 1. An Overview of Owl Input Bindings in Odoo 16 Enterprise
  • 2. Introduction Enterprise The Odoo Javascript framework uses a custom component framework called Owl(Odoo Web Library). Odoo 16 uses relies on the OWL for web development. It employs OWL concepts and principles in its POS system, with JavaScript code. In Odoo 16, Owl Input Bindings are a powerful feature that streamlines the development of interactive forms. It makes the Owl framework to establish a direct connection between data and user interface (UI) elements. That is, we can bind data from our Odoo models to input fields (text, numbers, dropdowns, etc.) and buttons within our templates, enabling real-time updates and a more responsive user experience.
  • 3. Enterprise The requirement to read the value from an HTML input (or textarea, or select) is extremely typical in order to use it (note: it is not required to be in a form). class Form extends owl.Component { state = useState({ text: "" }); _updateInputValue(event) { this.state.text = event.target.value; } } <div> <input t-on-input="_updateInputValue" /> <span t-esc="state.text" /> </div>
  • 4. Enterprise Also in OWL framework, t-model is a powerful directive that provides two-way data binding between an input element and a component's state. This means that any changes made to the input element will automatically update the state, and any changes to the state will update the input element. We may create shorter code instead the previous example using the t-model directive. class Form extends owl.Component { state = { text: "" }; } <div> <input t-model="state.text" /> <span t-esc="state.text" /> </div>
  • 5. Enterprise But, the code differs slightly if you have to use a checkbox, radio button, or select tags. In this case, OWL uses t-model directive which binds the input element to the inputValue property in the component's state. For example, for a group of radio buttons with same name (Here, either any of them can be selected at a time) <div> <label for="colorRed">Red</label> <input type="radio" id="colorRed" name="color" value="red" t-model="state.color"/> <label for="colorBlue">Blue</label> <input type="radio" id="colorBlue" name="color" value="blue" t-model="state.color"/> </div> Here, it binds the t-model to a data property in our component that holds the selected value, here ‘state.color’
  • 6. Enterprise For another example, in the case of <select> tags, <select t-model="selectedCountry"> <option value="">Select Country</option> <option value="US">United States</option> <option value="UK">United Kingdom</option> </select> selectedCountry can be the selected option value. The t-model binds with the value provided as options for the select tag.
  • 7. Enterprise We can use modifiers with t-model for advanced behaviour such as lazy updates, debouncing, trimming, etc ● t-model.lazy for Lazy Updates, meaning the data property is only updated when the user explicitly submits the form. That is, it updates the value on the change event (when the user interacts with the UI element) Additional Considerations: <input type="text" t-model.lazy="name" /> ● t-model.debounce delays the update of the bound data property by a specified time (in milliseconds) after the user stops typing. <input type="text" t-model.debounce="500"="searchTerm" />
  • 8. Enterprise ● t-model.trim for Trimming Input, meaning removes any leading or trailing whitespace characters from the user's input before updating the bound data property. <input type="text" t-model.trim="username" /> <input type="text" t-model.number="quantity" /> ● t-model.number for Parsing Numbers. It attempts to convert the user's input into a numerical value before updating the bound data property.
  • 9. Enterprise ● We can combine multiple modifiers with t-model for even more control. For instance, t-model.debounce.trim would debounce user input and then trim any whitespace before updating the data property. In short, Owl Input Bindings in Odoo 16 offer a significant boost to the development experience and the resulting user experience of our interactive and dynamic forms with real-time updates, automatic validation, and error handling.
  • 10. For More Info. Check our company website for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo. Enterprise www.cybrosys.com