Skip to content

Commit 88301e2

Browse files
committed
[IMP] Website Themes - Forms
[IMP] Website Themes - Forms [FIX] Anchors + Modifications after code review closes #12224 Signed-off-by: Brandon Mercier (bram) <[email protected]>
1 parent 4e0f298 commit 88301e2

File tree

1 file changed

+30
-38
lines changed
  • content/developer/howtos/website_themes

1 file changed

+30
-38
lines changed

content/developer/howtos/website_themes/forms.rst

+30-38
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,34 @@ In this chapter, you will discover how to:
1111
- Change the action of the form.
1212
- Stylize the form thanks to Bootstrap variables.
1313

14+
.. _website_themes/forms/default_forms :
15+
1416
Default form
1517
============
1618

17-
To add a form to your page, you can simply copy and paste the code generated by the Website Builder
18-
in your view.
19+
To add a form to a page, copy and paste the code generated by the Website Builder in the page.
1920

2021
It should look something like the following.
2122

2223
.. code-block:: xml
2324
24-
<form action="/website/form/" method="post" enctype="multipart/form-data" class="o_mark_required" data-mark="*" data-pre-fill="true" data-success-mode="redirect" data-success-page="/contactus-thank-you" data-model_name="mail.mail">
25+
<form
26+
action="/website/form/" method="post"
27+
enctype="multipart/form-data"
28+
class="o_mark_required"
29+
data-mark="*" data-pre-fill="true"
30+
data-success-mode="redirect"
31+
data-success-page="/contactus-thank-you"
32+
data-model_name="mail.mail">
2533
<div class="s_website_form_rows row s_col_no_bgcolor">
26-
<div class="form-group s_website_form_field col-12 s_website_form_dnone" data-name="Field">
27-
<!-- form fields -->
34+
<div class="form-group s_website_form_field col-12 s_website_form_dnone" data-name="Field">
35+
<!-- Form fields -->
2836
</div>
2937
</div>
3038
</form>
3139
40+
.. _website_themes/forms/actions :
41+
3242
Actions
3343
=======
3444

@@ -71,10 +81,22 @@ Create a task.
7181
7282
<form data-model_name="project.task">
7383
84+
.. note::
85+
86+
The default action is :guilabel:`Send an E-mail` but following the Apps installed on the database, some
87+
other options can be found, such as: Apply for a job, create a customer, create a ticket, create an
88+
opportunity, etc.
89+
90+
Please, note that some of these actions may need specific required fields in order to be
91+
functional. To not forget some requirements, we highly recommend to preset the form snippet with
92+
the Website Builder and copy/paste the generated source code.
93+
94+
.. _website_themes/forms/success :
95+
7496
Success
7597
=======
7698

77-
You can also define what happens once the form is submitted thanks to the `data-success-mode`.
99+
Define what happens once the form is submitted thanks to the `data-success-mode` attribute.
78100

79101
Redirect the user to a page defined in the `data-success-page`.
80102

@@ -88,8 +110,8 @@ Show a message (on the same page).
88110
89111
<form data-success-mode="message">
90112
91-
You can add your success message directly under the form tag. Always add the `d-none` class to make
92-
sure that your success message is hidden if the form hasn't been submitted.
113+
Add a success message directly under the form tag. Always add the `d-none` class to make
114+
sure that the success message is hidden if the form hasn't been submitted.
93115

94116
.. code-block:: xml
95117
@@ -102,33 +124,3 @@ sure that your success message is hidden if the form hasn't been submitted.
102124
</section>
103125
</div>
104126
</div>
105-
106-
Bootstrap variables
107-
===================
108-
109-
As you already know, the Website Builder creates content based on Bootstrap. This is also true for
110-
forms. Below you can find a selection of Bootstrap variables, or check out the `full list of
111-
variables <https://github.com/twbs/bootstrap/blob/main/scss/_variables.scss>`_.
112-
113-
.. code-block:: scss
114-
:caption: ``/website_airproof/static/src/scss/bootstrap_overridden.scss``
115-
116-
$input-padding-y: $input-btn-padding-y !default;
117-
$input-padding-x: $input-btn-padding-x !default;
118-
119-
$input-font-family: $input-btn-font-family !default;
120-
$input-font-size: $input-btn-font-size !default;
121-
$input-font-weight: $font-weight-base !default;
122-
$input-line-height: $input-btn-line-height !default;
123-
124-
$input-color: $gray-700 !default;
125-
$input-border-color: $gray-400 !default;
126-
$input-border-width: $input-btn-border-width !default;
127-
$input-box-shadow: inset 0 1px 1px rgba($black, .075) !default;
128-
$input-border-radius: $border-radius !default;
129-
130-
$input-focus-bg: $input-bg !default;
131-
$input-focus-border-color: lighten($component-active-bg, 25%) !default;
132-
$input-focus-color: $input-color !default;
133-
$input-focus-width: $input-btn-focus-width !default;
134-
$input-focus-box-shadow: $input-btn-focus-box-shadow !default;

0 commit comments

Comments
 (0)