File tree 12 files changed +91
-1
lines changed
12 files changed +91
-1
lines changed Original file line number Diff line number Diff line change 43
43
* [ error_handling] ( error_handling ) - how to handle failures;
44
44
* [ external_script] ( external_script ) - calling an external JavaScript file;
45
45
* [ form_and_long_process] ( form_and_long_process ) - how to deal with long "background" processes;
46
- * [ forms_brandind] ( forms_branding ) - using forms with custom HTML/CSS;
46
+ * [ custom_form] ( custom_form ) - using forms with custom HTML/CSS and a templating library;
47
+ * [ custom_form_basic] ( custom_form_basic ) - a basic example of a custom form;
47
48
* [ forms_override] ( forms_override ) - how to override default values in forms;
48
49
* [ groovy] ( groovy ) - running a Groovy script from a flow;
49
50
* [ groovy_grape] ( groovy_grape ) - how to use Groovy's ` @Grab ` in scripts;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ # Forms
2
+
3
+ Example of using custom forms.
Original file line number Diff line number Diff line change
1
+ flows :
2
+ default :
3
+ - form : myForm
4
+ fields :
5
+ - name : { type: "string", value: "${initiator.displayName}" }
6
+
7
+ - log : " ${myForm}"
Original file line number Diff line number Diff line change
1
+ data = {
2
+ "submitUrl" : "/api/service/custom_form/6cf435f0-b85c-42ea-a454-1ac308aff8c3/9fe117b3-5dec-4de2-afe7-1765a0e4e305/continue" ,
3
+ "success" : false ,
4
+ "definitions" : {
5
+ "name" : {
6
+ "type" : "string" ,
7
+ "cardinality" : "ONE_AND_ONLY_ONE"
8
+ }
9
+ } ,
10
+ "values" : {
11
+ "name" : "John Smith"
12
+ }
13
+ } ;
Original file line number Diff line number Diff line change
1
+ <!doctype html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="utf-8 ">
5
+ < title > My Form</ title >
6
+ < script src ="data.js "> </ script >
7
+ </ head >
8
+ < body >
9
+
10
+ < h1 > My Form</ h1 >
11
+
12
+ < p > Example of a very basic custom form.</ p >
13
+
14
+ < h2 id ="successBox " style ="display: none; ">
15
+ Success!
16
+ </ h2 >
17
+
18
+ < h2 id ="errorBox " style ="display: none; ">
19
+ Validation error!
20
+ </ h2 >
21
+
22
+ < form id ="myForm " method ="post " enctype ="multipart/form-data " onsubmit ="handleOnSubmit() ">
23
+ < label for ="nameField "> Name</ label >
24
+ < input id ="nameField " name ="name "/>
25
+ < button id ="submitButton " type ="submit "> Submit</ button >
26
+ </ form >
27
+
28
+ < script >
29
+ function handleOnSubmit ( ) {
30
+ // disable the button after submit
31
+ var b = document . getElementById ( "submitButton" ) ;
32
+ b . disabled = true ;
33
+ b . textContent = "Submitting..." ;
34
+ }
35
+
36
+ var form = document . getElementById ( "myForm" ) ;
37
+ form . action = data . submitUrl ;
38
+
39
+ document . getElementById ( "nameField" ) . value = data . values . name ;
40
+
41
+ if ( data . success ) {
42
+ // make the "success box" visible if the form was successfully submitted
43
+ document . getElementById ( "successBox" ) . style . display = "block" ;
44
+ // and hide the form, we don't need it anymore
45
+ form . style . display = "none" ;
46
+ }
47
+
48
+ if ( data . errors ) {
49
+ // show validation errors if any
50
+ document . getElementById ( "errorBox" ) . style . display = "block" ;
51
+ }
52
+ </ script >
53
+
54
+ </ body >
55
+ </ html >
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ SERVER_ADDR=" $1 "
4
+
5
+ rm -rf target && mkdir target
6
+ cp -R concord.yml forms target/
7
+
8
+ cd target && zip -r payload.zip ./* > /dev/null && cd ..
9
+
10
+ read -p " Username: " CURL_USER
11
+ curl -u ${CURL_USER} -F archive=@target/payload.zip http://${SERVER_ADDR} /api/v1/process
You can’t perform that action at this time.
0 commit comments