ADDING INPUTS FORM FACTORY V2

Similar documents
TECHNICAL ARCHITECTURE FORM FACTORY V2

AngularJS. CRUD Application example with AngularJS and Rails 4. Slides By: Jonathan McCarthy

WIDGETS TECHNICAL DOCUMENTATION PORTAL FACTORY 2.0

AngularJS. CRUD Application example with AngularJS and Rails 4. Slides By: Jonathan McCarthy

Jahia Studio JAHIA DOCUMENTION

Working Bootstrap Contact form with PHP and AJAX

TUTORIAL. HOW TO: - Edit with Microsoft Word - Send with Microsoft Outlook

PORTALS, DASHBOARDS AND WIDGETS DIGITAL EXPERIENCE MANAGER 7.2

Programming web design MICHAEL BERNSTEIN CS 247

EXAM - 1Y Managing Citrix XenDesktop 7.6 Solutions. Buy Full Product.

Dreamweaver MX The Basics

Digital Factory 7 Search and Query API under the hood

Django Forme Documentation

PVII HEADLINE SCROLLER MAGIC

This project will use an API from to retrieve a list of movie posters to display on screen.

Understanding Angular Directives By Jeffry Houser

Tarek Elachkar, VP Customer Solutions - Jahia A real world story of Angular and Apache Unomi integration.

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2003

Building JSR-286 portlets using AngularJS and IBM Web Experience Factory

Contents AD SPECIFICATIONS AND STYLE GUIDE 2017

TUTORIAL HOW TO: - Edit an Template with Constant Contact Create an

THE HITCHHIKERS GUIDE TO. Harper Maddox CTO, EdgeTheory 30 September 2014

Spring Data JPA, Spring Boot, Oracle, AngulerJS 적용게시판실습 게시판리스트보기.

AngularJS. Beginner's guide - part 2

Dingle Coderdojo 6. Project Part 2 (of 2) - Movie Poster And Actor! - Lookup. Week 6

User manual Scilab Cloud API

Ten good practices for ASP.NET MVC applications

widgetjs Documentation

AngularJS Introduction

AngularJS AN INTRODUCTION. Introduction to the AngularJS framework

Project Part 2 (of 2) - Movie Poster And Actor! - Lookup

HTML CS 4640 Programming Languages for Web Applications

AD SPECIFICATIONS AND STYLE GUIDE IMPORTANT INFORMATION Please ensure that all Third Party Tags are SSL compatible (see page 9)

WRITING CONSOLE APPLICATIONS IN C

HOMELESS INDIVIDUALS AND FAMILIES INFORMATION SYSTEM HIFIS 4.0 TECHNICAL ARCHITECTURE AND DEPLOYMENT REFERENCE

A4: HTML Validator/Basic DOM Operation

Lecture 7. Action View, Bootstrap & Deploying 1 / 40

INTRODUCTION TO WEB DEVELOPMENT IN C++ WITH WT 4

Getting started with M-Files

AngularJS Intro Homework

Composer Help. Import and Export

PVII Tree Menu Magic 3

Adobe Dreamweaver CS4

Creating Pages with the CivicPlus System

Introduction to web page creation

( )

PERMISSION REPORTER V4.0

Frontend Frameworks. SWE 432, Fall 2016 Design and Implementation of Software for the Web

Responsive Web Design and Bootstrap MIS Konstantin Bauman. Department of MIS Fox School of Business Temple University

Apros 6 Demo download and installation

Supervision and control XML-based from Windows Vista to Windows CE

Software Architecture Documentation for the JRC MYGEOSS app for Invasive Species project

Importing non-numerical character data

Creating a Course Web Site

Configuring Ad hoc Reporting. Version: 16.0

SureClose Advantage. Release Notes Version

Intellicus Enterprise Reporting and BI Platform

Session 5. Web Page Generation. Reading & Reference

Digital Factory 7 - SDK Quick installation instructions

Web Programming and Design. MPT Senior Cycle Tutor: Tamara Week 2

Building Web Applications

Sample CS 142 Midterm Examination

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2010

Index LICENSED PRODUCT NOT FOR RESALE

AngularJS. Beginner's guide - part 1

HOW TO USE CODE::BLOCKS IDE FOR COMPUTER PROGRAMMING LABORATORY SESSIONS

Appendix C: Advanced Video Settings

Mastering the APEX Universal Theme

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2005

Site Owners: Cascade Basics. May 2017

HarePoint Business Cards

AngularJS Fundamentals

SiteAssist Professional - Getting Started Guide

AUTOMATIC PROCESSOR 1

Shadow Health as an LTI Provider

Template Builder User Guide. Product Version 1.0 August 11, 2017

Visualizing Venice Historic Environment Record (Geospatial Database)

Defining New Node-RED Nodes

Start editing and publishing content right away.

Contents AD SPECIFICATIONS AND STYLE GUIDE 2018

in rich text controls as well as Word Document templates by adding them as document properties and these into the template.

PA3 Design Specification

Advanced Angular & Angular 6 Preview. Bibhas Bhattacharya

Flowpack Expose Documentation

Dynamic Web Templates

A Guided Tour of Doc-To-Help

How to lay out a web page with CSS

Developing Intelligent Apps

a Very Short Introduction to AngularJS

AD SPECIFICATIONS AND STYLE GUIDE 2018

Form Validation (with jquery, HTML5, and CSS) MIS Konstantin Bauman. Department of MIS Fox School of Business Temple University

Dashboards. Overview. Overview, page 1 Dashboard Actions, page 2 Add Widgets to Dashboard, page 4 Run a Report from the Dashboard, page 6

Ektron Content Marketing Platform Product Notes

Ektron Content Marketing Platform Product Notes

OneStop Reporting OSR Budgeting 4.5 User Guide

HOW TO ACCESS AND SUBMIT DOCUMENTS TO SUMMIT FOR PROCESSING USING REDTAIL

TUTORIAL: D3 (1) Basics. Christoph Kralj Manfred Klaffenböck

Haymarket Business Media RECRUITMENT AD SPECIFICATIONS AND STYLE GUIDE 2018

S-Drive User Guide v1.27

USER GUIDE MADCAP FLARE SharePoint

Transcription:

1

Example input This tutorial will guide you through creation of a simple text input field. I will use form-factorysnippets-extension module but you can use any module with dependency on Form Factory. WARNING: If you copy-paste code from this document you will have to make sure that all characters are properly transferred. Pay close attention to hyphens. Also, if you create your views using Studio make sure you remove all taglibs that get generated by default. IMPORTANT: When working with JavaScript it may be necessary to flush browser cache after changes to Javascript files. Most modern browsers provide an add-on tool to perform cache flushes. To get such a tool for your browser you should search available add-ons with a search criteria such as clear cache or empty cache, select appropriate add-on and follow given instructions. 1) Create definition The first thing you need to do is to create a definition. All input definitions are standard and only the name of the input field should change. Your input definition should look like this: [fcnt:exampleinputdefinition] > jnt:content, fcmix:definition, mix:title, jmix:droppablecontent, jmix:hiddentype* 2) Create views The next step is to create views and a wizard file. Your folder structure should be identical to the following: We ll provide more details for each file later but a brief description should help to see the big picture clearer; the designview is used to display and modify input properties defined by the wzd file. The default view (exampleinputdefinition.jsp) is used to display the input that users will see and interact with while the directive view provides the input directive (it will load the default view) with any logic that may be necessary for your input. 3) Create wizard (exampleinputdefinition.wzd) All Form Factory components have a wizard that is used to define properties/structure. The input wizard must have 5 mandatory properties: label, template, wizard, supportedlogictypes and supportedvalidationtypes. The label is used to generate the name of the node that will be used to store the definition; we lowercase and dasherize it (i.e. text-input). The template is the directive which gets inserted directly into html markup. The wizard is similar to template but it is used to display the design view. The supportedlogictypes and supportedvalidationtypes properties specify the types of logics and validations supported by the input. Aside from the mandatory properties you can add 2002 2016 Jahia Solutions Group SA Page 2 / 5

optional properties by placing them inside a properties object or propertiesi18n if you wish the properties to be translatable. Here s what your wizard should look like: package fcnt_inputdefinition.html input { label "Example input" template "<ff-example-input></ff-example-input>" wizard "<ff-example-input view-type='designview'></ff-example-input>" supportedvalidationtypes "required", "equal", "length", "number", "regex" supportedlogictypes "valid", "input" properties { inputsize "input-md" propertiesi18n { helptext "Help" placeholder "Example input" 4) Create input view (exampleinputdefinition.jsp) When creating your view you have access to the Angular s form controller and the input object which contains properties specified by the wizard. The view should look like this: <div class="form-group" ng-class="{'has-error': form[input.name].$invalid&&form.$dirty" ng-show="resolvelogic()"> <label class="col-sm-2 control-label"> {{input.label <div class="col-sm-10"> <input type="text" placeholder="{{input.placeholder" class="form-control {{input.inputsize" name="{{input.name" ng-model="input.value" ng-required="isrequired()" ng-readonly="readonly" ff-validations ff-logic> <span class="help-block" ng-show="input.helptext!= undefined"> {{input.helptext </span> <span class="help-block" ng-repeat="(validationname, validation) in input.validations" ng-show="form[input.name].$error[(validationname normalize)]&&form.$dirty"> {{validation.message </span> <div class="clearfix"/> There are a few important things you need to note: You must use resolvelogic() function to determine visibility of your input You must use isrequired() function to determine if input is required You must include readonly test You must include help-blocks for help text and validation messages You are free to organize your html/text as you see fit 2002 2016 Jahia Solutions Group SA Page 3 / 5

5) Create design view (exampleinputdefinition.designview.jsp) Design view is used to aid form creation; it allows you to edit wizard properties or restrict them from being edited if you are in translate mode. Design view should normally include all of the available properties and place a restriction, with the help of intranslatemode flag, on those which should not be editable in translate mode. Here s how a simple design view might look like: <div class="row"> <div class="row" ng-if="!intranslatemode"> <span message-key="ff.label.changeinputfieldname"></span> <input type="text" class="form-control" ng-model="input.name"/> <div class="clearfix"> <span message-key="ff.label.changeinputsize"></span> <select class="form-control" ng-model="input.inputsize"> <option value="input-lg" message-key="ff.label.large"></option> <option value="" message-key="ff.label.medium"></option> <option value="input-sm" message-key="ff.label.small"></option> </select> <span message-key="ff.label.changelabel"></span> <input type="text" class="form-control" ng-model="input.label"/> <span message-key="ff.label.changeplaceholder"></span> <input type="text" class="form-control" ng-model="input.placeholder"/> <span message-key="ff.label.changehelptext"></span> <input type="text" class="form-control" ng-model="input.helptext"/> As with the input view the html markup is up to you to design. Note that Form Factory provides most common keys (i. e. ff.label.changelabel) but you can also create your own keys if you need. 6) Create directive (exampleinputdefinition.directive.jsp) Directive views are easy to create and in most cases will require little to no coding. But these views are very powerful as they can be easily used to add functionality to your input, for example you may add code to display dynamic placeholders or add animation to your input. A standard directive view has the following structure: <%@ page contenttype="text/javascript" %> <%@ taglib prefix="formfactory" uri="http://www.jahia.org/formfactory/functions" %> <%--@elvariable id="rendercontext" type="org.jahia.services.render.rendercontext"--%> angular.module('formfactory').directive('ffexampleinput', ['$log', 'fftemplateresolver', function ($log, fftemplateresolver) { var directive = { restrict: 'E', 2002 2016 Jahia Solutions Group SA Page 4 / 5

require: ['^ffcontroller'], templateurl: function(el, attrs) { return fftemplateresolver.resolvetemplatepath('${formfactory:addformfactorymodulepath('/formfactory-definitions/example-input', rendercontext)', attrs.viewtype);, link: linkfunction ; return directive; function linkfunction(scope, el, attr, ctrl) { ]); As you can see it is a standard Angular directive but we expect that you do the following: Name your directive with ff prefix to avoid potential collisions Make sure that the name is the one used by the template and the wizard specified in the wzd file and that it is unique (failure to do so will break angular). According to this example directive will be compiled with <ff-example-input></ff-example-input> (see template property in wizard) hence the name of our directive is ffexampleinput. Make sure you require ffcontroller Import fftemplateresolver and use it to resolve view path. The only thing that will change is the node name after /form-factory-definitions/ subpath (see next point). Import the view with subpath /form-factory-definitions/<lowercased, dasherized label specified in wizard file>. Our label in wizard file is Example input consequently we import the view using example-input to find the right node. Add all necessary resource bundle labels (use ff.label.input.<lowercased, dasherized label specified in wizard file> for input name label), deploy your module, add it to your site and you should be able to use your newly created input. 2002 2016 Jahia Solutions Group SA Page 5 / 5