Git Product home page Git Product logo

dxa-forms-module's Introduction

DXA Forms Module

The DXA Forms Module is a module for SDL Digital Experience Accelerator (DXA) that provides functionality to easily create web forms in SDL Web. Forms are managed as regular components that can be added to any page. In web applicaton web forms are implemented as classic html forms that are styled with Bootstrap framework.

DXA Forms Module allows to create classic Web Forms as well as AJAX Web Forms that will submit data without refreshing the page.

So far DXA Forms Module support next field types:

  • Text
  • Text Area
  • DropDown
  • Check Box
  • Radio Button
  • Date

DXA Forms Module comes with built in support for client and server side validation of fields data. You can configure field as required or set more comprehensive validation based on regular expression. Client side validation is implemented with Unobtrusive JQuery Validation library.

How form data will be processed depends on configured form handlers. There are multiple form handlers that are available out of the box, like: EmailHandler, AudienceManagerHandler, etc. Of course you can implement custom form handler that will meet your needs.

Prerequisites

DXA 1.6 and SDL Web 8/8.5

Installation

Content Manager (Step 1)

  1. Import DXA Forms Module package into CMS
  2. Publish Forms Structure Group
  3. Publish Test Category
  4. Republish Publish Settings page

Web Application (Step 2)

  1. Unzip DXA Forms Module Web into your web application
  2. Configure web.config
  • Add next sections and configure smtp server credentials
 <system.diagnostics>
    <sources>
      <source name="AudienceManagerLogger" switchName="sourceSwitch">
        <listeners>
          <add name="AudienceManagerTraceListener" />
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add name="AudienceManagerTraceListener" initializeData="C:\Temp\logs\am_client.log" rollSizeKb="102400" timestampPattern="yyyy-MM-dd" rollFileExistsBehavior="Increment" rollInterval="Midnight" maxArchivedFiles="0" type="Sdl.AudienceManager.ContentDelivery.Logging.TraceListeners.RollingFlatFileTraceListener, Sdl.AudienceManager.ContentDelivery" />
    </sharedListeners>
    <switches>
      <add name="sourceSwitch" value="Warning" />
    </switches>
  </system.diagnostics>
  <system.net>
    <mailSettings>
      <smtp from="YOUR_EMAIL_ADDRESS">
        <network host="smtp.gmail.com" port="587" userName="YOUR_USER_NAME" password="YOUR_PASSWORD" defaultCredentials="false" enableSsl="true" />
      </smtp>
    </mailSettings>
  </system.net>
  1. Enable UnotrusiveJavaScrip in web.config
  • Add next line to your appSettings
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
  1. Add JavaScript and CSS references to your Layout.cs
  • Insert next code after @RenderBody()
    <script src="~/Scripts/jquery-1.8.0.min.js"></script>
    <script src="~/Scripts/jquery.validate.min.js"></script>
    <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
    <script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
    <script src="~/Scripts/bootstrap-datepicker.min.js"></script>
    <link href="~/Content/bootstrap-datepicker.min.css" rel="stylesheet" />
    <script type="text/javascript">
        (function ($) {

            $.validator.unobtrusive.adapters.add("mandatory", function (options) {
                options.rules["required"] = true;
                if (options.message) {
                    options.messages["required"] = options.message;
                }
            });
        }(jQuery));
    </script>
  1. If you will use Audience Manager Handler make sure that cd_audience_manager_conf.xml exist in your config folder

Testing (Step 3)

  1. Run your applicatoin
  2. Navigatoin to /forms/form-test
  3. You should see working test form

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.