Wisdom.CreateForm


The wisdom.ui.createForm() function creates a new HTML FORM element, initializes it with the provided attribute values and returns the new element to the calling code so that it can be placed into the DOM tree.

Over and above the basic properties accepted by the createElement() function, createForm accepts an options.controls attribute that can be provided as a array of HTML form control elements, or objects that can initialize new elements created by the function.

module: wisdom.ui

dependancies: wisdom, wisdom.console

Specification:

Example usage:

var tempForm = wisdom.ui.createForm({
    name: "hiddenForm",
    action: downloadFileUrl,
    method: "post",
    controls: [
        { control: "input", type: "text", name: "name", value: "Enter Name" },
        { control: "input", type: "text", name: "age", value: "Enter Age" },
        { control: "input", type: "text", name: "email", value: "Enter Email Address" },
    ]
});

Another potential way to provide the options.controls array using DOM references rather than option initializers (not yet implemented):

	controls: [
		wisdom.ui.createElement("input", { type: "hidden", name: "fileId", value: fileIdValue },
		wisdom.ui.createElement("input", { type: "hidden", name: "userId", value: "NONAME" },
		wisdom.ui.createElement("input", { type: "hidden", name: "password", value: "mypassword" }
	]

See also


This is part of the Reference Documentation for the Wisdom Javascript Library? (or wisdom.js)