Wiki source code of Dynamische Elemente
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{content/}} | ||
| 2 | |||
| 3 | In forms even dynamic elements can occur. These fields are duplicated during the input. A typical example here is the declaration of e.g. people living in one houshold. If you e.g. select //5//, the (% style="line-height:1.4em" %)respective block is displayed five times. Another example is the opporunity of any number of [[uploads>>doc:Formcycle.Designer.Form.FormElements.Upload]]. | ||
| 4 | |||
| 5 | {{figure image="FCSnapshot0.png"}} | ||
| 6 | An application example for dynamic elements. The data of students are acquired, the number of students is at that variable. | ||
| 7 | {{/figure}} | ||
| 8 | |||
| 9 | Repeated elements are created directly in the {{designer/}} or by using the JavaScript function {{jsdoc page="jquery" name="dynamic"/}}. | ||
| 10 | |||
| 11 | == Triage of dynamic elements == | ||
| 12 | |||
| 13 | Within the possible actions, dynamic elements are treated as follows. | ||
| 14 | |||
| 15 | If a dynamic element is used in the [[inbox>>doc:Formcycle.Inbox.WebHome]] or in the [[workflow>>doc:Formcycle.Designer.Workflow.WebHome]] later, all values of its dynamic elements, connected with a comma, are redelivered. By creating a new column in the inbox for the dynamic field with the name //tf1//, all values in the column in the inbox than appear comma seperated. | ||
| 16 | |||
| 17 | In the form itself every duplicated element gets a name after the schema //Elementname_index//. So, if three pieces of the element //tf1// existed, the fields with the name //tf1_0//, //tf1_1// and //tf1_2// would be generated. To these fields it can also be accessed directly with this name in inboxes or in the action processing. | ||
| 18 | |||
| 19 | To select all duplicated elements, it can be accessed with the attribute //org_name// instead of //name//. | ||
| 20 | |||
| 21 | == Examples == | ||
| 22 | |||
| 23 | All dynmically created fields of a primal form field are selected with //org_name//. | ||
| 24 | |||
| 25 | {{code language="javascript"}} | ||
| 26 | $("[name=tf1]") // Selects the non-dynamic textfield tf1. | ||
| 27 | $("[org_name=tf2]") // Selects all dynamically created versions of the textfield tf2. | ||
| 28 | {{/code}} | ||
| 29 | |||
| 30 | To like select the second duplicated element of a dynamic element with the name //tf1//, the following code can be used. | ||
| 31 | |||
| 32 | {{code language="javascript"}} | ||
| 33 | $($("[org_name=tf1]").get(1)) // Selects the second dynamically created element of the textfield tf1. | ||
| 34 | {{/code}} |