jsdoc.formBuilder¶
File: biweeklybudget/flaskapp/static/js/formBuilder.js
-
FormBuilder
(id)¶ Create a new FormBuilder to generate an HTML form
Arguments: - id (String) – The form HTML element ID.
-
FormBuilder.
addCheckbox
(id, name, label, checked)¶ Add a checkbox to the form.
Arguments: - id (String) – The id of the form element
- name (String) – The name of the form element
- label (String) – The label text for the form element
- checked (Boolean) – Whether to default to checked or not
Returns: FormBuilder – this
-
FormBuilder.
addCurrency
(id, name, label, options)¶ Add a text
input
for currency to the form.Arguments: - id (String) – The id of the form element
- name (String) – The name of the form element
- label (String) – The label text for the form element
- options (Object) –
- options.htmlClass (String) – The HTML class to apply to the element; defaults to
form-control
. - options.helpBlock (String) – Content for block of help text after input; defaults to null.
- options.groupHtml (String) – Additional HTML to add to the outermost form-group div. This is where we’d usually add a default style/display. Defaults to null.
Returns: FormBuilder – this
-
FormBuilder.
addDatePicker
(id, name, label, options)¶ Add a date picker input to the form.
Arguments: - id (String) – The id of the form element
- name (String) – The name of the form element
- label (String) – The label text for the form element
- options (Object) –
- options.groupHtml (String) – Additional HTML to add to the outermost
Returns: FormBuilder – this
-
FormBuilder.
addHTML
(content)¶ Add a string of HTML to the form.
Arguments: - content (String) – HTML
Returns: FormBuilder – this
-
FormBuilder.
addHidden
(id, name, value)¶ Add a hidden
input
to the form.Arguments: - id (String) – The id of the form element
- name (String) – The name of the form element
- value (String) – The value of the form element
Returns: FormBuilder – this
-
FormBuilder.
addLabelToValueSelect
(id, name, label, selectOptions, defaultValue, addNone, options)¶ Add a select element to the form, taking an Object of options where keys are the labels and values are the values. This is a convenience wrapper around
budgetTransferDivForm()
.Arguments: - id (String) – The id of the form element
- name (String) – The name of the form element
- label (String) – The label text for the form element
- selectOptions (Object) – the options for the select, label to value
- defaultValue (String) – A value to select as the default
- addNone (Boolean) – If true, prepend an option with a value of “None” and an empty label.
- options (Object) – Options for rendering the control. Passed through unmodified to
FormBuilder.addSelect()
; see that for details.
Returns: FormBuilder – this
-
FormBuilder.
addP
(content)¶ Add a paragraph (
p
tag) to the form.Arguments: - content (String) – The content of the
p
tag.
Returns: FormBuilder – this
- content (String) – The content of the
-
FormBuilder.
addRadioInline
(name, label, options)¶ Add an inline radio button set to the form.
Options is an Array of Objects, each object having keys
id
,value
andlabel
. Optional keys arechecked
(Boolean) andonchange
, which will have its value placed literally in the HTML.Arguments: - name (String) – The name of the form element
- label (String) – The label text for the form element
- options (Array) – the options for the select; array of objects each having the following attributes:
- options.id (String) – the ID for the option
- options.value (String) – the value for the option
- options.label (String) – the label for the option
- options.checked (Boolean) – whether the option should be checked by default (optional; defaults to false)
- options.inputHtml (String) – extra HTML string to include in the actual
input
element (optional; defaults to null)
Returns: FormBuilder – this
-
FormBuilder.
addSelect
(id, name, label, selectOptions, options)¶ Add a select element to the form.
Arguments: - id (String) – The id of the form element
- name (String) – The name of the form element
- label (String) – The label text for the form element
- selectOptions (Array) – the options for the select, array of objects (order is preserved) each having the following attributes:
- selectOptions.label (String) – the label for the option
- selectOptions.value (String) – the value for the option
- selectOptions.selected (Boolean) – whether the option should be the default selected value (optional; defaults to False)
- options (Object) –
- options.htmlClass (String) – The HTML class to apply to the element; defaults to
form-control
. - options.helpBlock (String) – Content for block of help text after input; defaults to null.
- options.groupHtml (String) – Additional HTML to add to the outermost form-group div. This is where we’d usually add a default style/display. Defaults to null.
Returns: FormBuilder – this
-
FormBuilder.
addText
(id, name, label, options)¶ Add a text
input
to the form.Arguments: - id (String) – The id of the form element
- name (String) – The name of the form element
- label (String) – The label text for the form element
- options (Object) –
- options.groupHtml (String) – Additional HTML to add to the outermost
- options.inputHtml (String) – extra HTML string to include in the actual
input
element (optional; defaults to null) - options.helpBlock (String) – Content for block of help text after input; defaults to null.
Returns: FormBuilder – this
-
FormBuilder.
addTextArea
(id, name, label, options)¶ Add a Text Area to the form.
Arguments: - id (String) – The id of the form element
- name (String) – The name of the form element
- label (String) – The label text for the form element
- options (Object) –
- options.groupHtml (String) – Additional HTML to add to the outermost
- options.inputHtml (String) – extra HTML string to include in the actual
input
element (optional; defaults to null) - options.helpBlock (String) – Content for block of help text after input; defaults to null.
Returns: FormBuilder – this
-
FormBuilder.
render
()¶ Return complete rendered HTML for the form.
Returns: String – form HTML