Forms

Form blocks are used to collect information from website visitors and, if applicable, create records in the database. To add a form to a website page, drag and drop the Contact & Forms categorical building block, then select a block in the pop-up window.

アクション

By default, submitting a form sends an email containing the visitor's submitted information. Depending on the apps installed on the database, additional actions that can automatically create records may become available. To choose a different action, click Edit, select a form field, navigate to the Style tab, and, in the Form section, select the desired Action:

  • 求人に応募 (採用)

  • Create a Customer (eCommerce)

  • チケットを作成 (ヘルプデスク)

  • 案件を作成 (CRM)

  • ニュースレターに登録 (メールマーケティング)

  • タスクを作成`(:doc:`プロジェクト </applications/services/project>)

  • さらに表示モデル:他のタイプのレコードを生成する

By default, submitting the form redirects visitors to a Thank you page. Use the URL field to send them to a different page. Alternatively, select Nothing or Show Message in the On Success field to keep visitors on the form's page.

It is also possible to define the Labels Width, specify whether fields are Required or Optional in the Marked Fields, and define a Mark Text to indicate required fields.

ちなみに

Configure the visibility settings for forms.

フィールド

To add a new field to the form, navigate to the Style tab and click the + Field button in the Form or Field header section. To modify any field on the form, select the field, then use the options available in the Field section of the Style tab. For example, you can:

  • :guilabel:`Type`フィールドを変更します。

    ちなみに

    データベースから:guilabel:`Existing Field`を選択し、そこに含まれるデータを使用することも可能です。使用可能なフィールドは、選択したアクションによって異なります。データベースに追加されたプロパティフィールドも使用できます。

    すべてのタイプのフォームフィールド

    一部のフィールドは見た目が似ていますが、入力されるデータは特定の形式に従う必要があります。

  • フィールドの:guilabel:`Label`を編集し、:guilabel:`Position`を調整します。

  • フィールド:guilabel:`説明`を有効にします。スイッチをオンにして、フォーム上のデフォルトの説明をクリックして変更します。

  • フィールドが:guilabel:`Required`かどうかを指定します。

  • Use the Requirement field to add validation Conditions to ensure customers enter valid information. For example, set the condition requiring the Email field to contain an @ symbol.

  • :ref:`アニメーション <website/elements/animations>`を追加します。

  • Edit the field's visibility settings.

Depending on the selected field, the following options are available:

For text & string fields, such as Text, Long Text, Email, and Url, as well as numerical fields, such as Telephone, Number, and Decimal Number, you can define a Placeholder and a Default Value.

For the Long Text field, you can also specify the field's Height.

To apply the changes, click Save.

ちなみに

Modify the text of the Submit button by clicking it and entering the desired text. Then, change the Button Position in the Submit Button section of the Style tab.

Odoo以外のウェブサイトにOdooお問い合わせフォームを追加

iframeを使用して、別のウェブサイトにOdooお問い合わせフォームを表示できます。これを行うには、次の手順に従います:

  1. Prepare the Odoo form: Create a contact form on a page in Odoo Website and remove the header and footer design. Make sure only the contact form remains on the page.

  2. 埋め込みコードを生成: OdooフォームページのURLをコピーし、`La Digitale.dev <https://ladigitale.dev/digitools/generateur-iframe>`_や`iFrame Generator <https://www.iframe-generator.com/>`_などのiframeジェネレーターに貼り付けます。適切に表示されるように幅と高さを調整します。

  3. Add the embedded code to the non-Odoo website: Open the relevant page's HTML (in the code editor or CMS) and insert the embedded code where the form should be displayed.

Example

埋め込みコードの例:

<iframe src="https://example.com/odoo-form"
        style="border:0;"
        name="odooForm"
        scrolling="no"
        frameborder="0"
        marginheight="0"
        marginwidth="0"
        height="400px"
        width="600px"
        allowfullscreen>
 </iframe>