蜜豆视频

Getting Started with Edge Delivery Services for AEM Forms using Universal Editor (WYSIWYG)

Version
Article link
Universal Editor-based Authoring
This article
Document-based Authoring
Click here

This feature is available through the early access program. To request access, send an email from your official address to aem-forms-ea@adobe.com with your GitHub organization name and repository name. For example, if the repository URL is https://github.com/adobe/abc, the organization name is adobe and the repository name is abc.

In today鈥檚 digital age, user-friendly forms are essential for all organizations. Edge Delivery Services Forms are created using the Universal Editor, which offers WYSIWYG (what-you-see-is-what-you-get) capabilities. It provides a modern, intuitive interface for efficient form authoring.

AEM Forms provide a block, known as the Adaptive Forms Block, to help you easily create Edge Delivery Services Forms to capture and store data. You can create a new AEM Project pre-configured with the Adaptive Forms Block or add the Adaptive Forms Block to an existing AEM Project.

Github Repository Workflow {align="center" width="50%"}

This tutorial guides you through creating, previewing, and publishing your own form with a new or existing 蜜豆视频 Experience Manager Site project using Universal Editor鈥檚 WYSIWYG authoring.

Prerequisites

  • You have a GitHub account, and understand Git basics.
  • You understand the basics of HTML, CSS, and JavaScript.
  • You have Node/npm installed for local development.

Create a new AEM project pre-configured with Adaptive Forms Block

The AEM Forms Boilerplate template gets you started quickly with an AEM project pre-configured with the Adaptive Forms Block. It is the quickest and easiest way to follow AEM best practices and jump right into building your forms.

Get started with the AEM Forms boilerplate repository template

  1. Create a GitHub repository for your AEM Project. To create repository:

    1. Go to .

      AEM Forms Boilerplate

    2. Click the Use this template option and select the Create a new repository option.

      Create new repository using AEM Forms Boilerplate

      The Create a new repository screen opens.

    3. On the Create a new repository screen, select the owner, and specify Repository name . 蜜豆视频 recommends to set the repository to Public. So, select the public option, and click Create Repository.

      Set the repository to public

  2. Install the AEM Code Sync GitHub App on your repository. To install:

    1. Go to .
    2. On the Install AEM Code Sync screen, select the Only select Repositories option and select your newly created repository. Click Save.

    Set the repository to public

  3. Now link the GitHub repository you created using AEM Forms Boilerplate to your AEM Project authoring environment. To connect:

    1. Go to the GitHub repository that you created eariler using AEM Forms Boilerplate.

    2. Open the fstab.yaml file for editing.

      open fstab.yaml file

    3. Edit the fstab.yaml file to update the mount point of your project. Replace the URL with the URL of your AEM as a Cloud Service authoring instance.
      https://<aem-author>/bin/franklin.delivery/<owner>/<repository>/main

      edit fstab.yaml file

    4. Commit the updated fstab.yaml file, once you have updated the reference and everything looks good.

      commit the changes

      If you encounter any build issues, see Troubleshooting GitHub build issues.

Create a new AEM Project

Now that you have a GitHub project, you can proceed to create and publish a new AEM Project at the AEM as a Cloud Service authoring instance.

  1. To create a new AEM Project:

    1. Login to AEM as a Cloud Service authoring instance and select Sites.

      select sites

    2. Click Create > Site from template.

      create-sites

    3. Select the Edge Delivery Services Site template and click Next.

      select-site-template

      note note
      NOTE
      • If the Edge Delivery Services Site template is not available on your authoring instance, click the Import button to upload the template.
      • You can download the Edge Delivery Services Site templates from .
    4. Enter the following details to create a new AEM Project:

      • Site title - Add a descriptive title for the site.
      • Site title - Use the site-name that you defined in the previous step.
      • GitHub URL - Use the URL of the GitHub project you created in the previous step.

      create AEM Site

    5. The Create Site dialog appears, click Okay.

      click ok

      In just a few minutes, your new AEM Project is created.

    6. Navigate to your newly-created AEM project in the Sites console and click Edit.
      In this case, the index.html page is used for illustration.

      edit AEM Site

      The AEM Project opens in the Universal Editor in a new tab, enabling WYSIWYG authoring. You can now edit your AEM Project.

      Site opens in Universal Editor

  2. Publish your created AEM Project

    Once you finish editing your AEM Project, publish it. To publish:

    1. On the Sites console, select all of the AEM Project pages and click Quick Publish.

      publish AEM Sites Project

    2. The Quick Publish confirmation dialog appears, click Publish to start the publishing process.

      Quick Publish confirmation dialog

      Alternatively, you can publish your AEM Project pages directly from the Universal Editor user interface.

      Quick Publish confirmation dialog

    Congratulations! You have a new website running on https://<branch>--<repo>--<owner>.aem.page/content/<site-name>/.

    • <branch> refers to the branch of your GitHub repository.
    • <repository> denotes your GitHub repository.
    • <owner> refers to username of your GitHub account that hosts your GitHub repository.
    • <site-name> refers to the name of your created site name.

    For example, if the branch name is main, repository is edsforms, owner is wkndforms and the site-name is eds-forms, the website would be up and running at https://main--edsforms--wkndforms.aem.page/content/eds-forms/

    note note
    NOTE
    • To view the index.html page of the AEM Project, use the URL: https://<branch>--<repo>--<owner>.aem.page/content/<site-name>/
    • To view pages other than the index page of the AEM Project, use the URL: https://<branch>--<repo>--<owner>.aem.page/content/<site-name>/<site-page-name>

Now, you can start creating and adding forms to your AEM Project.

Add Adaptive Forms Block to your existing AEM Project

If you have an existing AEM Project, you can integrate the Adaptive Forms Block into your current project to get started on form creation.

NOTE
This step applies to projects built with the . If you created your AEM Project using the , you can skip this step.

To integrate:

  1. Add required files and folders

    1. Copy and paste the following folders and files from the into your AEM Project:

      • folder
      • folder
      • folder
      • file
      • file
  2. Update component definitions and models files

    1. Navigate to the ../models/_component-definition.json file in your AEM Project and update it with the changes from the .

    2. Navigate to the ../models/_component-models.json file in your AEM Project and update it with the changes from the

  3. Add Form Editor in editor script

    1. Navigate to the ../scripts/editor-support.js file in your AEM Project and update it with the changes from the
  4. Update ESLint configuration file

    1. Navigate to the ../.eslintignore file in your AEM Project and add the following line of codes to prevent errors related to the Form Block rule engine:

      code language-none
          blocks/form/rules/formula/*
          blocks/form/rules/model/*
      
  5. Commit and push these changes to your AEM Project repository on GitHub.

That鈥檚 it! The Adaptive Forms Block is now part of your AEM Project. You can start creating and adding forms to your AEM Project.

Author Forms using WYSIWYG

You can open your AEM Project in the Universal Editor for WYSIWYG authoring, where you can edit the project and add the Adaptive Form section to include Edge Delivery Services forms on AEM Project pages.

  1. Add the Adaptive Form section to your AEM Project page. To add:

    1. Navigate to your AEM project in the Sites console, select the site page you want to edit, and click Edit. The AEM project page opens in Universal Editor for editing.
      In this case, the index.html page is used for illustration.
    2. Open the Content tree and navigate to a section where you want to add the Adaptive Form section.
    3. Click the Add icon and select the Adaptive Form component from the component list.

    content tree

    The Adaptive Form section is added. You can now begin adding form components to the AEM Project page.

  2. Add form components to the added Adaptive Form section. To add form components:

    1. Navigate to the added Adaptive Form section in the Content tree.

      adaptive form block added

    2. Click the Add icon and add the desired components from the Adaptive Form Components list.

      add component

      You can also drag and drop the required Adaptive Forms components, as the Universal Editor offers an intuitive drag-and-drop feature.

    3. Select the added Adaptive Form component to update its properties using Properties.

      open properties

    4. Preview the form.
      The screenshot below displays the form authored in the AEM Project using WYSIWYG authoring:

      added form

      Once satisfied with the preview, the user can proceed to publish the page.

      note note
      NOTE
      It is important to publish your AEM Project page again after making changes; otherwise, the updates are not visible in the browser.
  3. Re-publish the AEM Project page.

    1. Click Publish to publish the AEM Project page again after adding the form.

      publish form

    2. The Publish confirmation dialog appears on screen, click Publish to start publishing.

      publish form1

      Once you click the Publish button, the Publish started successfully message appears.

      publish form2

    You can now view the AEM Project page with the added Edge Delivery Services Form at the following URL:
    https://<branch>--<repo>--<owner>.aem.page/content/<site-name>/.

    For example, if the branch name is main, the repository is edsforms, the owner is wkndforms, and the site-name is eds-forms, the URL would be:
    https://main--edsforms--wkndforms.aem.page/content/eds-forms/

    index page

You can style the Edge Delivery Services Forms by editing the .css and .js files in the Adaptive Forms Block and setting up a local AEM development environment to view the changes instantly in your browser.

Set up local AEM development environment

You can set up a local AEM development environment for developing custom styles and components locally. To be up and running with a local AEM development environment:

  1. Install the AEM CLI: The AEM CLI simplifies development tasks. Let鈥檚 install it globally using npm:

    code language-bash
        npm install -g @adobe/aem-cli
    
  2. Clone your GitHub project: Clone your AEM Project repository from GitHub using the following command, replacing with the repository owner and with the repository name:

    code language-none
    
    git clone https://github.com/<owner>/<repo>
    
  3. Start Your Local Environment: Navigate to your project directory and start your local AEM instance with a single command:

    code language-none
    cd <repo>
    aem up
    

You can make local changes in the Adaptive Forms Block blocks/form folder for styling and coding for your forms! Edit the .css or .js files within this directory, and you can see that the changes reflected instantly in your browser.

Once you have completed your changes, use Git commands to commit and push them. This updates your preview and production environments, accessible at the following URLs (replace placeholders with your project details):

Preview: https://<branch>--<repo>--<owner>.aem.page/content/<site-name>

Production: https://<branch>--<repo>--<owner>.aem.live/content/<site-name>

Troubleshooting GitHub build issues

Ensure a smooth GitHub build process by addressing potential issues:

  • Handle Linting Errors:
    Should you come across any linting errors, you can bypass them. Open the [EDS Project]/package.json file and modify the 鈥渓int鈥 script from "lint": "npm run lint:js && npm run lint:css" to "lint": "echo 'skipping linting for now'". Save the file and commit the changes to your GitHub project.

  • Resolve Module Path Error:
    If you encounter the error "Unable to resolve path to module 鈥溾樷/鈥/scripts/lib-franklin.js鈥欌, navigate to the [EDS Project]/blocks/forms/form.js file. Update the import statement by replacing the lib-franklin.js file with the aem.js file.

See also

recommendation-more-help
fbcff2a9-b6fe-4574-b04a-21e75df764ab