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
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
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"/>
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up