How to create a web form with validation (example, email must have @ symbol, phone must have numbers and +-() symbols) without model?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hello Volodymyr,
For creating a website form, please refer to the below link:
https://www.cybrosys.com/blog/how-to-create-a-website-form-in-odoo-15
For creating form validations for different fields in the form web,
1) You can use field attributes like type="email" for email and type="tel" for phone etc. in input fields when creating a template of a particular form for the web.
2) For an email field you can do as follows:
You can also specify pattern attributes inside the input field like pattern=".+@globex\.com" size="30".
This will automatically show validation like using "@" in email, etc. when the user enters the email and submits the form.
3) For a phone validation You can use input type="tel" and define your pattern for accepting phone numbers.
You can customize your own pattern as needed.
Hope it will be helpful to you.
Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari
Please find the Code for point 2 & 3
2 :
<input type="email" class="form-control" name="email" placeholder="Enter email"/>
3:
<input type="tel" id="phone" name="phone" pattern="['+']{1}[7-9]{1}[0-9]{9}" title="Phone number starting with +,following 7,8 or 9 as next digit and remaining 9 digits between 0-9"/>
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký