===== Basics for creating a smartform ===== === HTML === HTML stands for **Hyper Text Markup Language** and is the standard markup language for creating websites. In combination with other languages like **Cascading Style Sheets (CSS)** and **JavaScript** HTML is the basis of web-development. Therefor HTML is used to determine the structure of websites. HTML is therefor not a programming but a markup language and is thus easy to learn. \\ In the following some useful HTML elements for smartform building are presented. A detailed documentation as well as various tutorials can be found under [[http://www.w3schools.com / | W3Schools]]. === CSS === CSS or Cascading Style Sheets are used to affect the **design or presentation** of websites created with HTML. CSS is designed to seperate structure and presentation of a website. Normally the styles are defined in seperate .css files. \\ The User experience besides the functionality heavily influenced by a appealing design. The visual editing with CSS is an important part of the smartform design. \\ A detailed documentation as well as various tutorials can be found under [[http://www.w3schools.com / | W3Schools]]. === JavaScript === Javascript is a client-side programming language, which is executed in the browser. While HTML and CSS represent the website's static content, **user interaction** can be reacted to with Javascript. Furthermore functionalities like calculation or auto completes can be implemented. \\ A detailed documentation as well as various tutorials can be found under [[http://www.w3schools.com / | W3Schools]]. ---- ===== Planning ===== Before implementing a smartform, its structure, design and functionalities should be planned carefully. Smarforms provide a process with necessary information. A good starting point for planning is which information is needed at which point in the process sequence. These are functional requirements. \\ When the functional requirements are clear, they hav to be implemented in a user friendly design. It should be noted which users have to work with the smartform. An appealing user interface really makes working with the smartfrom easier. However the functionalities should always come before the aestethics. \\ When planning a smartform using a paper prototype or mockups can be useful. Drafts can be discussed with endusers and can also be modified. For creating a mockup or a prototype there are many different helpful tools like [[https://balsamiq.com/ | Balsamiq Mockup]] or [[https://www.sketchapp.com/ | Sketch]]. ---- ===== Using Frameworks===== {{ :software:tim:bs.png?}} To make web development more comfortable, various HTML, CSS and JavaScript frameworks have been developed. We regularly use [[http://www.getbootstrap.org | Bootstrap]] when developing smartforms. **Bootstrap** offers predefined CSS classes, that enable the development of an appealing and responsive smartform design. How Bootstrap is integrated into the form is shown in our detailed [[smartform-example | smartform-example]]. Besides **Bootstrap** libraries like [[ http://www.polymer-project.org | Polymer ]] gain in popularity. Besides Bootstrap and Polymer the Javascript library [[https://jquery.com/ | jQuery]] is an important component of smartform development. The extensive API offers various functions, like to catch user input. \\ For very complex smartform with complicated calculations or requests the framework AngularJS, developed by Google, is very useful. Of course it is possible to integrate own frameworks either via the HTML code of the smartform of via the custom.js file (explained in the [[smartform-example | smartform-example]]). {{:software:tim:angularJs.png?150}} ---- ===== An Appropriate Editor===== {{ :software:tim:brackets.jpg?150}} A Smartform can be create in a simple text editor. However editors, that specify in programming, have a lot of advantages, like line indentation, code highlighting or autocompletes. \\ Popular editors are e.g. [[https://notepad-plus-plus.org/ | Notepad++]], [[http://brackets.io/ | Brackets]] and [[http://www.sublimetext.com/3 | Sublime Text]]. ---- === Create a form === For creating a form an opening
and a closing
- tag are required. These two tags mark the beginning and the end of the document. The content to be displayed is located between these two tags.
---- === Class and name for the form === A form needs a class and a name. Those are defined within the opening
- tags.
---- === Make form visible for all TIM users === With the attribute security="all" any TIM-User is authorized to view this form.
---- === Integrate Javascript === The Javascript file corresponding to HTML is located in the JBoss in the register: .....server\default\deploy\loom.ear\loom-portal.war\custom\ In the folder, which belongs to the required client, is a file with the name [[#javascript_einbinden|custom.js]]. This is a Javascript file, which is automatically integrated into the HTML form and thus is usable for the smartform. If functions are necessary for the form Javascript, those can be phrased in the file. The attribute initMethod="" specifies which JavaScript function runs by loading the smartform.
The attribute validationMethod="" specifies which JavaScript function runs before saving the smartform. A useful application would be for example a required field check.
The validationMethod must reply either "true" or "false". With "true" it is stored , with "false" it is not stored. Here is an illustrative example: gadget.functions.initValidation=function(){ if(INSERT CONDITION){ // do something alert("data were stored!"); return true; } else{ // do something alert("Storing not possible!"); return false; } } ---- === Create table === {{ :en:software:tim:table.jpg |}} The opening **table** tag indicates the beginning of a table. Within the subsequent **colgroup** the width for each column is specified. In this case, a table with 3 columns, 100 pixel of width each, shall be created. \\ The **tr** tag is the starting point for a new row within a table, while the **td** tag begins a new column. Within the **td** tag it is exactly defined in which row and column you are and the desired content can be entered here.
column1 row1 column2 row1 column3 row1
column1 row2 column2 row2 column3 row2
column1 row3 column2 row3 column3 row3
=== Integrate Image (Logo)=== {{ :en:software:tim:table_logo.jpg |}} To integrate an image the tag **img** is required. The attribute src=".." (the path to the desired image is given here) and the attribute alt=".." (this is displayed when the image can not be loaded) has to be given to this. In this example the image should be located in the first column. Because the image would be too big, it can be scaled down by the additional attribute **width**. This defines the width of the image in pixel.
logo column2 column3
column1 column2 column3
column1 column2 column3
---- === Selection box (Radiobuttons) === {{ :en:software:tim:table_radiobuttons.png |}} Radiobuttons are selection boxes that are always grouped together. Only one choice can be made from this group. For this the type 'radio' is assigned to the "in-itself-closing" - element. To consolidate multiple radiobuttons to one group, the same 'name'-attribute must be assigned to it. If a radiobutton is already checked when opening the smartform, the attribute 'checked="checked' must be assigned to it. PLEASE NOTE! This attribute can only have one radiobutton for each radiobutton group. For all - elements the [[process_variables| process variables]] are set on 'id', only for radiobuttons the process variable is set on the 'name' attribute. The attribute colspan="2" connects a table cell with the following table cell (to the right). If the selection of a radiobutton is also possible by clicking on the associated label, the label must be enclosed by an opening - tag. This is addressed with the attribute 'for=""' via the 'id' of the respective -elements. With a
- element (break) a new line is generated.


column3
column1 column2 column3
column1 column2 column3
---- === Selection box (Checkboxes) === {{ :en:software:tim:table_checkbox.png |}} Checkboxes are also selection boxes, but can be clicked individually and independently. Otherwise, the same rules apply as those for buttons.


column3
column1 column2 column3
column1 column2 column3
---- === Choice box (Selectbox) === {{ :en:software:tim:table_select.png |}} For creating a selectbox, an opening - tag are necessary. To add options for selection to this, any number of **options** can be added between the column3 column1 column2 column3 column1 column2 column3 ---- === Input field === {{ :en:software:tim:table_eingabe.png |}} There are different types of input fields in which free text can be written. For a normal text array, the tag **input** is used in combination with the attribute **type="text"**. This forms a simple text field with one row. (see element 1)\\ For creating an input field (e.g. for description), an opening - tag are necessary. This can be resized by the user and multiple rows can be written in. (see element 2)
column3
column1 column2 column3
column3
---- === Formatting in textareas === To offer the formatting elements cursive, bold, underlined, blue font and red font in a textarea, the class **richtext** has to be given. Attention! The variable's name also has to contain richtext and bootstrap has to be loaded (data-bootstrap="true" in
). {{ :software:tim:actionhandler:chrome.png?300 |:software:tim:datepicker.png}} ---- ===Datepicker (Calender)=== To create a so-called Datepicker to an input field, only the class **datepicker** must be given to it. The Javascript library **JQuery**, which is automatically integrated into every smartform, opens now by clicking a field a calender from which a date can be selected, which is then transferred in the input field. {{ :en:software:tim:datepicker.png |}} ---- === Add stylesheets (CSS) === {{ :en:software:tim:table_css.png |}} The stylesheets are defined between an opening - tag. The attribute 'type="text/css"' must be assigned to the opening
column3
column1 column2 column3
column1 column2 column3
---- === Mandatory field at instance start === If an input field has to be already defined as a mandatory field at the instance start, the attribute "required" with the value "true" is necessary. If a Selectbox changes into a mandatory field and the basic option (eg, "Please select ...") should be defined as not a valid value, the attribute default="default" of this option must be included.