Use this to add an "edit with form" link to articles using the template (i.e. of the record type).
{{EditWithForm|Activity}}
Content for Record Forms
Show a section of the form based on a checkbox state
Often many parts of a form are only relevant depending on other values, for example a biiling address may only be shown if the "same as shipping address" check-box is not ticked.
In this example, we have added an onChange event to the checkbox which causes things to show/hide. Only two things even need to be changed in this statement, first the "BillingAddress" which defines the element that will be affected when the value changes, and second the order of the 'none' : '' can be switched if the tick should correspond to hidden state rather than shown as it currently does.
Next there is a div tag surrounding the area to be shown/hidden which must have an id attribute to be referred to by the checkbox's onChange event. Note that I have also added the style attribute that is used to ensure the form is initially in the correct state, it sets the style to display:none if the UseShipping value is set.
<input
name = "UseShipping"
type = "checkbox"
onchange = "document.getElementById('BillingAddress').style.display=this.checked ? 'none' : ''"
/> Use shipping address
<div id="BillingAddress" style="{{{UseShipping|display:none}}}">
Street: <input name="Street" />
City: <input name="City" />
</div>
Result
Use shipping address
Street:
City:
Tooltips
{{Tooltip|label|content}}
*This* is a tooltip example, mouse over it to see.
The tooltip is a common graphical user interface element. It is used in conjunction with a cursor, usually a mouse pointer. The user hovers the cursor over an item, without clicking it, and a small "hover box" appears with supplementary information regarding the item being hovered over.
Select list examples
Select a Record
Selecting a record will have a special parser function made for it so that instead of passing a single record type, a list or tree of records can be supplied.
Forms use AJAX to render inline using a link
Link is red if an instance doesn't currently exist
Link works as a show/hide of form for single records, a tab-set for a list, or a tree-view for hierarchical lists
It's expected that this be the primary method of creating sub-forms, so there's no need to select from lists of records
Following is a useful JavaScript function for setting default times in a form such as in Form:Activity. It sets the start time to the current local time if it's empty, and only sets the end time to the current time if the start time is already populated.
function setDefaultTimes(start,end){var now = new Date();
var hour = now.getHours();
var min = now.getMinutes();
now = (hour<10?'0'+hour:hour) + ':' + (min<10?'0'+min:min);
var start = document.getElementById(start);
var end = document.getElementById(end);
if(start.value)if(end.value == '') end.value = now;
if(start.value == '') start.value = now;
}