0cd93b5df5fa6c9334eb7aa5e907ed0f7b37daa6
Guides/ReportDesign/14.0-Izenda-FORMS.md
| ... | ... | @@ -159,9 +159,32 @@ And this is an incorrect use: |
| 159 | 159 | [/repeater] |
| 160 | 160 | ``` |
| 161 | 161 | |
| 162 | -### Adding Javascript to a Form |
|
| 162 | +### Adding inline Javascript to a Form |
|
| 163 | 163 | |
| 164 | -Use the <!--FORMSCRIPT--> tag to insert inline javascript into a form. |
|
| 164 | +To add javascript to a form inline, you must do two things. |
|
| 165 | + |
|
| 166 | +First, you must place your script inside the <!--FORMSCRIPT--> tag. |
|
| 167 | + |
|
| 168 | +Second, you must place a container div with the id 'launchmeplease' inside the script tag. |
|
| 169 | + |
|
| 170 | +This example script generates a custom date format: |
|
| 171 | + |
|
| 172 | +<!--FORMSCRIPT--> |
|
| 173 | +<div id="launchmeplease"> |
|
| 174 | +var d = new Date(); |
|
| 175 | +var currDay = d.getDate(); |
|
| 176 | +var currMonth = d.getMonth() + 1; |
|
| 177 | +var currYear = d.getFullYear(); |
|
| 178 | +var fullDate = currMonth + "-" + currDay + "-" + currYear; |
|
| 179 | +jq$(".myCustomDate").html(fullDate) |
|
| 180 | +</div> |
|
| 181 | +<!--FORMSCRIPT--> |
|
| 182 | + |
|
| 183 | +Once the date object has been created, we pull out various aspects of it and combine them to create our custom value, here named 'fullDate'. We then use jquery to find all divs of the class 'myCustomDate' and replace the inner text with the value of fullDate. On our form, we would then place a div wherever we want a custom date: |
|
| 184 | + |
|
| 185 | +<div class="myCustomDate">You should not see this!!</div> |
|
| 186 | + |
|
| 187 | +The text inside the div, 'You should not see this!!', is error text that will appear instead of the date if something goes wrong. |
|
| 165 | 188 | |
| 166 | 189 | ##Video Tutorials |
| 167 | 190 |