Element#

Element base class#

Experiment, position, and identification (Element)#

exp

The experiment session to which this element belongs.

experiment

Alias for exp

name

Unique identifier for the element.

page

The page to which this element belongs.

section

The direct parent section of this element's page.

tree

String, giving the exact position in the experiment.

short_tree

String, giving the exact position in the experiment.

General utilities (Element)#

converted_width

List of bootstrap column widths at different screen sizes.

element_width

Returns a string of column width definitions.

width

Element width

position

Position of the whole element on the page.

font_size

Font size

css_class_container

Returns the name the element container's CSS class.

css_class_element

Returns the name of the element's CSS class.

should_be_shown

Boolean, indicating whether the element is meant to be shown.

showif

Conditions that have to be met for the element to be shown.

Development utilities (Element)#

These methods and attributes are most likely to be of interest to you only if you derive your own sections.

add_css(code[, priority])

Adds CSS to the element.

css_code

A list of tuples, which contain a priority and CSS code.

css_urls

A list of tuples, which contain a priority and an url pointing to CSS code.

add_js(code[, priority])

Adds Javascript to the element.

js_code

A list of tuples, which contain a priority and Javascript.

js_urls

A list of tuples, which contain a priority and an url pointing to JavaScript.

added_to_experiment(experiment)

Tells the element that it was added to an experiment.

added_to_page(page)

Tells the element that it was added to a page.

prepare_web_widget()

Hook for computations for preparing an element's web widget.

render_inner_html(template_data)

Renders the element template element_template.

base_template

Base template for the element, which will be used to hold the rendered element template.

element_template

The element's specific, inner template.

template_data

Dictionary of data to be passed on to jinja templates.

web_widget

The element's rendered html code for display on a page.

LabelledElement Attributes and Methods (Element)#

rightlab

Label to the right of the main element widget.

leftlab

Label to the left of the main element widget.

toplab

Label above of the main element widget.

bottomlab

Label below of the main element widget.

labels

Returns the labels in a single, nicely formatted string.

InputElement Attributes and Methods (Element)#

Data (InputElement)#

data

Dictionary of element data.

codebook_data

Information about the element in dictionary form.

input

Subject input to this element.

General utilities (InputElement)#

hint_manager

A MessageManager, handling the corrective hints for this element.

corrective_hints

Shortcut for accessing the element's corrective hints.

show_hints

Flag, indicating whether corrective hints regarding this element should be shown.

default_no_input_hint

Default hint if subject input is missing in force_entry elements.

prefix

A string or element, serving as prefix.

suffix

A string or element, serving as suffix.

debug_enabled

Boolean flag, indicating whether debug mode is enabled and default values should be set.

debug_value

Value to be used as a default in debug mode.

default

Default value of this element.

disabled

A boolean flag, indicating whether the element is disabled A disabled input element is shown and displays its input value, but subjects cannot enter any data.

force_input

If True, subjects must fill this element to proceed.

description

Detailed description of this element to be added to the automatically generated codebook

Development utilities (InputElement)#

These methods and attributes are most likely to be of interest to you only if you derive your own sections.

set_data(d)

Sets the input data.

validate_data([silent])

Method for validation of input to the element.