Module frontend.app.forms

Classes

class AnswerForm (formdata=<object object>, **kwargs)

Form for submitting answers to questions.

Includes fields for different types of answers.

:param formdata: Input data coming from the client, usually request.form or equivalent. Should provide a "multi dict" interface to get a list of values for a given key, such as what Werkzeug, Django, and WebOb provide. :param obj: Take existing data from attributes on this object matching form field attributes. Only used if formdata is not passed. :param prefix: If provided, all fields will have their name prefixed with the value. This is for distinguishing multiple forms on a single page. This only affects the HTML name for matching input data, not the Python name for matching existing data. :param data: Take existing data from keys in this dict matching form field attributes. obj takes precedence if it also has a matching attribute. Only used if formdata is not passed. :param meta: A dict of attributes to override on this form's :attr:meta instance. :param extra_filters: A dict mapping field attribute names to lists of extra filter functions to run. Extra filters run after filters passed when creating the field. If the form has filter_<fieldname>, it is the last extra filter. :param kwargs: Merged with data to allow passing existing data as parameters. Overwrites any duplicate keys in data. Only used if formdata is not passed.

Expand source code
class AnswerForm(FlaskForm):
    """
    Form for submitting answers to questions.

    Includes fields for different types of answers.
    """
    short_text = StringField("Answer")  # Field for short text answers
    long_text = TextAreaField("Answer")  # Field for long text answers
    true_false = RadioField("Answer", coerce=int)  # Radio field for true/false answers
    likert_scale = RadioField("Answer", coerce=int)  # Radio field for Likert scale answers
    multiple_choice = MultiCheckboxField("Answer", coerce=int)  # Multiple checkbox field for multiple choice answers
    scale_number = IntegerRangeField("Answer")  # Field for scale number answers
    submit = SubmitField("Next")  # Submit button
    skip = SubmitField("Skip")  # Skip button

Ancestors

  • flask_wtf.form.FlaskForm
  • wtforms.form.Form
  • wtforms.form.BaseForm

Class variables

var likert_scale
var long_text
var multiple_choice
var scale_number
var short_text
var skip
var submit
var true_false
class AnswerOptions (formdata=<object object>, **kwargs)

Form for defining options for a question.

Includes fields for value and label of the options.

:param formdata: Input data coming from the client, usually request.form or equivalent. Should provide a "multi dict" interface to get a list of values for a given key, such as what Werkzeug, Django, and WebOb provide. :param obj: Take existing data from attributes on this object matching form field attributes. Only used if formdata is not passed. :param prefix: If provided, all fields will have their name prefixed with the value. This is for distinguishing multiple forms on a single page. This only affects the HTML name for matching input data, not the Python name for matching existing data. :param data: Take existing data from keys in this dict matching form field attributes. obj takes precedence if it also has a matching attribute. Only used if formdata is not passed. :param meta: A dict of attributes to override on this form's :attr:meta instance. :param extra_filters: A dict mapping field attribute names to lists of extra filter functions to run. Extra filters run after filters passed when creating the field. If the form has filter_<fieldname>, it is the last extra filter. :param kwargs: Merged with data to allow passing existing data as parameters. Overwrites any duplicate keys in data. Only used if formdata is not passed.

Expand source code
class AnswerOptions(FlaskForm):
    """
    Form for defining options for a question.

    Includes fields for value and label of the options.
    """
    value = StringField("Value")  # Field for option value
    label = StringField("Label")  # Field for option label

Ancestors

  • flask_wtf.form.FlaskForm
  • wtforms.form.Form
  • wtforms.form.BaseForm

Class variables

var label
var value
class ConfirmationForm (formdata=<object object>, **kwargs)

Form for confirming an action.

Includes a hidden field and a submit button.

:param formdata: Input data coming from the client, usually request.form or equivalent. Should provide a "multi dict" interface to get a list of values for a given key, such as what Werkzeug, Django, and WebOb provide. :param obj: Take existing data from attributes on this object matching form field attributes. Only used if formdata is not passed. :param prefix: If provided, all fields will have their name prefixed with the value. This is for distinguishing multiple forms on a single page. This only affects the HTML name for matching input data, not the Python name for matching existing data. :param data: Take existing data from keys in this dict matching form field attributes. obj takes precedence if it also has a matching attribute. Only used if formdata is not passed. :param meta: A dict of attributes to override on this form's :attr:meta instance. :param extra_filters: A dict mapping field attribute names to lists of extra filter functions to run. Extra filters run after filters passed when creating the field. If the form has filter_<fieldname>, it is the last extra filter. :param kwargs: Merged with data to allow passing existing data as parameters. Overwrites any duplicate keys in data. Only used if formdata is not passed.

Expand source code
class ConfirmationForm(FlaskForm):
    """
    Form for confirming an action.

    Includes a hidden field and a submit button.
    """
    data = HiddenField("Data")  # Hidden field for storing data
    submit = SubmitField("Confirm")  # Submit button

Ancestors

  • flask_wtf.form.FlaskForm
  • wtforms.form.Form
  • wtforms.form.BaseForm

Class variables

var data
var submit
class ContactForm (formdata=<object object>, **kwargs)

Form for contacting support or sending a message.

Includes fields for name, email, message, and submit button.

:param formdata: Input data coming from the client, usually request.form or equivalent. Should provide a "multi dict" interface to get a list of values for a given key, such as what Werkzeug, Django, and WebOb provide. :param obj: Take existing data from attributes on this object matching form field attributes. Only used if formdata is not passed. :param prefix: If provided, all fields will have their name prefixed with the value. This is for distinguishing multiple forms on a single page. This only affects the HTML name for matching input data, not the Python name for matching existing data. :param data: Take existing data from keys in this dict matching form field attributes. obj takes precedence if it also has a matching attribute. Only used if formdata is not passed. :param meta: A dict of attributes to override on this form's :attr:meta instance. :param extra_filters: A dict mapping field attribute names to lists of extra filter functions to run. Extra filters run after filters passed when creating the field. If the form has filter_<fieldname>, it is the last extra filter. :param kwargs: Merged with data to allow passing existing data as parameters. Overwrites any duplicate keys in data. Only used if formdata is not passed.

Expand source code
class ContactForm(FlaskForm):
    """
    Form for contacting support or sending a message.

    Includes fields for name, email, message, and submit button.
    """
    name = StringField("Name")  # Field for name
    email = EmailField("E-Mail")  # Field for email
    message = TextAreaField("Message")  # Field for message
    submit = SubmitField("Send")  # Submit button

Ancestors

  • flask_wtf.form.FlaskForm
  • wtforms.form.Form
  • wtforms.form.BaseForm

Class variables

var email
var message
var name
var submit
class EvaluationForm (formdata=<object object>, **kwargs)

Form for evaluating something with a status and comments.

Includes fields for status and comments.

:param formdata: Input data coming from the client, usually request.form or equivalent. Should provide a "multi dict" interface to get a list of values for a given key, such as what Werkzeug, Django, and WebOb provide. :param obj: Take existing data from attributes on this object matching form field attributes. Only used if formdata is not passed. :param prefix: If provided, all fields will have their name prefixed with the value. This is for distinguishing multiple forms on a single page. This only affects the HTML name for matching input data, not the Python name for matching existing data. :param data: Take existing data from keys in this dict matching form field attributes. obj takes precedence if it also has a matching attribute. Only used if formdata is not passed. :param meta: A dict of attributes to override on this form's :attr:meta instance. :param extra_filters: A dict mapping field attribute names to lists of extra filter functions to run. Extra filters run after filters passed when creating the field. If the form has filter_<fieldname>, it is the last extra filter. :param kwargs: Merged with data to allow passing existing data as parameters. Overwrites any duplicate keys in data. Only used if formdata is not passed.

Expand source code
class EvaluationForm(FlaskForm):
    """
    Form for evaluating something with a status and comments.

    Includes fields for status and comments.
    """
    status = RadioField("Status", choices=[(1, "OK"), (0, "Not OK")], coerce=int)  # Radio field for status
    comment = TextAreaField("Comment")  # Field for additional comments
    submit = SubmitField("Submit")  # Submit button

Ancestors

  • flask_wtf.form.FlaskForm
  • wtforms.form.Form
  • wtforms.form.BaseForm

Class variables

var comment
var status
var submit
class ExportForm (formdata=<object object>, **kwargs)

Form for exporting data.

Includes a radio field to select data and a submit button.

:param formdata: Input data coming from the client, usually request.form or equivalent. Should provide a "multi dict" interface to get a list of values for a given key, such as what Werkzeug, Django, and WebOb provide. :param obj: Take existing data from attributes on this object matching form field attributes. Only used if formdata is not passed. :param prefix: If provided, all fields will have their name prefixed with the value. This is for distinguishing multiple forms on a single page. This only affects the HTML name for matching input data, not the Python name for matching existing data. :param data: Take existing data from keys in this dict matching form field attributes. obj takes precedence if it also has a matching attribute. Only used if formdata is not passed. :param meta: A dict of attributes to override on this form's :attr:meta instance. :param extra_filters: A dict mapping field attribute names to lists of extra filter functions to run. Extra filters run after filters passed when creating the field. If the form has filter_<fieldname>, it is the last extra filter. :param kwargs: Merged with data to allow passing existing data as parameters. Overwrites any duplicate keys in data. Only used if formdata is not passed.

Expand source code
class ExportForm(FlaskForm):
    """
    Form for exporting data.

    Includes a radio field to select data and a submit button.
    """
    tables = RadioField("Select data to export:", coerce=int)  # Radio field for selecting data to export
    submit = SubmitField("Generate Excel")  # Submit button

Ancestors

  • flask_wtf.form.FlaskForm
  • wtforms.form.Form
  • wtforms.form.BaseForm

Class variables

var submit
var tables
class JoinForm (formdata=<object object>, **kwargs)

Form for joining, either as a new user or returning user.

Includes submit buttons for both new and returning users.

:param formdata: Input data coming from the client, usually request.form or equivalent. Should provide a "multi dict" interface to get a list of values for a given key, such as what Werkzeug, Django, and WebOb provide. :param obj: Take existing data from attributes on this object matching form field attributes. Only used if formdata is not passed. :param prefix: If provided, all fields will have their name prefixed with the value. This is for distinguishing multiple forms on a single page. This only affects the HTML name for matching input data, not the Python name for matching existing data. :param data: Take existing data from keys in this dict matching form field attributes. obj takes precedence if it also has a matching attribute. Only used if formdata is not passed. :param meta: A dict of attributes to override on this form's :attr:meta instance. :param extra_filters: A dict mapping field attribute names to lists of extra filter functions to run. Extra filters run after filters passed when creating the field. If the form has filter_<fieldname>, it is the last extra filter. :param kwargs: Merged with data to allow passing existing data as parameters. Overwrites any duplicate keys in data. Only used if formdata is not passed.

Expand source code
class JoinForm(FlaskForm):
    """
    Form for joining, either as a new user or returning user.

    Includes submit buttons for both new and returning users.
    """
    new = SubmitField("New")  # Button for new users
    returning = SubmitField("Returning")  # Button for returning users

Ancestors

  • flask_wtf.form.FlaskForm
  • wtforms.form.Form
  • wtforms.form.BaseForm

Class variables

var new
var returning
class MonitoringForm (formdata=<object object>, **kwargs)

Form for creating or editing a monitoring task.

Includes fields for monitoring details, queries, countries, result counts, and frequency settings.

:param formdata: Input data coming from the client, usually request.form or equivalent. Should provide a "multi dict" interface to get a list of values for a given key, such as what Werkzeug, Django, and WebOb provide. :param obj: Take existing data from attributes on this object matching form field attributes. Only used if formdata is not passed. :param prefix: If provided, all fields will have their name prefixed with the value. This is for distinguishing multiple forms on a single page. This only affects the HTML name for matching input data, not the Python name for matching existing data. :param data: Take existing data from keys in this dict matching form field attributes. obj takes precedence if it also has a matching attribute. Only used if formdata is not passed. :param meta: A dict of attributes to override on this form's :attr:meta instance. :param extra_filters: A dict mapping field attribute names to lists of extra filter functions to run. Extra filters run after filters passed when creating the field. If the form has filter_<fieldname>, it is the last extra filter. :param kwargs: Merged with data to allow passing existing data as parameters. Overwrites any duplicate keys in data. Only used if formdata is not passed.

Expand source code
class MonitoringForm(FlaskForm):
    """
    Form for creating or editing a monitoring task.

    Includes fields for monitoring details, queries, countries, result counts,
    and frequency settings.
    """
    name = StringField("Monitoring name")  # Field for monitoring name
    description = TextAreaField("Monitoring description")  # Field for monitoring description
    queries = TextAreaField("Queries (use new line for each query)")  # Text area for entering queries
    countries = MultiCheckboxField("Select countries", coerce=int)  # Multiple checkbox field for selecting countries
    result_count = IntegerField("Number of results to collect")  # Integer field for specifying the number of results
    result_type = SelectField("Select result types", choices=[(2, "Snippets")], coerce=int)  # Dropdown for result types
    interval_frequency = SelectField("Frequency", choices=[(1, "once"), (2, "twice")])  # Dropdown for frequency
    interval_mode = SelectField("Mode", choices=[(1, "daily"), (2, "weekly"), (3, "monthly")], coerce=int)  # Dropdown for mode
    submit = SubmitField("Create monitoring")  # Submit button

Ancestors

  • flask_wtf.form.FlaskForm
  • wtforms.form.Form
  • wtforms.form.BaseForm

Class variables

var countries
var description
var interval_frequency
var interval_mode
var name
var queries
var result_count
var result_type
var submit
class MultiCheckboxField (label=None, validators=None, coerce=builtins.str, choices=None, validate_choice=True, **kwargs)

A custom field for multiple checkbox inputs.

Inherits from SelectMultipleField and uses a ListWidget with CheckBoxInput.

Construct a new field.

:param label: The label of the field. :param validators: A sequence of validators to call when validate is called. :param filters: A sequence of callable which are run by :meth:~Field.process to filter or transform the input data. For example StringForm(filters=[str.strip, str.upper]). Note that filters are applied after processing the default and incoming data, but before validation. :param description: A description for the field, typically used for help text. :param id: An id to use for the field. A reasonable default is set by the form, and you shouldn't need to set this manually. :param default: The default value to assign to the field, if no form or object input is provided. May be a callable. :param widget: If provided, overrides the widget used to render the field. :param dict render_kw: If provided, a dictionary which provides default keywords that will be given to the widget at render time. :param name: The HTML name of this field. The default value is the Python attribute name. :param _form: The form holding this field. It is passed by the form itself during construction. You should never pass this value yourself. :param _prefix: The prefix to prepend to the form name of this field, passed by the enclosing form during construction. :param _translations: A translations object providing message translations. Usually passed by the enclosing form during construction. See :doc:I18n docs <i18n> for information on message translations. :param _meta: If provided, this is the 'meta' instance from the form. You usually don't pass this yourself.

If _form isn't provided, an :class:UnboundField will be returned instead. Call its :func:bind method with a form instance and a name to construct the field.

Expand source code
class MultiCheckboxField(SelectMultipleField):
    """
    A custom field for multiple checkbox inputs.

    Inherits from SelectMultipleField and uses a ListWidget with CheckBoxInput.
    """
    widget = widgets.ListWidget(prefix_label=False)
    option_widget = widgets.CheckboxInput()

Ancestors

  • wtforms.fields.choices.SelectMultipleField
  • wtforms.fields.choices.SelectField
  • wtforms.fields.choices.SelectFieldBase
  • wtforms.fields.core.Field

Class variables

var option_widget
var widget
class ParticipantLogInForm (formdata=<object object>, **kwargs)

Form for participant login.

Includes fields for username, password, and login button.

:param formdata: Input data coming from the client, usually request.form or equivalent. Should provide a "multi dict" interface to get a list of values for a given key, such as what Werkzeug, Django, and WebOb provide. :param obj: Take existing data from attributes on this object matching form field attributes. Only used if formdata is not passed. :param prefix: If provided, all fields will have their name prefixed with the value. This is for distinguishing multiple forms on a single page. This only affects the HTML name for matching input data, not the Python name for matching existing data. :param data: Take existing data from keys in this dict matching form field attributes. obj takes precedence if it also has a matching attribute. Only used if formdata is not passed. :param meta: A dict of attributes to override on this form's :attr:meta instance. :param extra_filters: A dict mapping field attribute names to lists of extra filter functions to run. Extra filters run after filters passed when creating the field. If the form has filter_<fieldname>, it is the last extra filter. :param kwargs: Merged with data to allow passing existing data as parameters. Overwrites any duplicate keys in data. Only used if formdata is not passed.

Expand source code
class ParticipantLogInForm(FlaskForm):
    """
    Form for participant login.

    Includes fields for username, password, and login button.
    """
    username = StringField("Username")  # Field for username
    password = PasswordField("Code")  # Field for password
    submit = SubmitField("Log in")  # Submit button

Ancestors

  • flask_wtf.form.FlaskForm
  • wtforms.form.Form
  • wtforms.form.BaseForm

Class variables

var password
var submit
var username
class QuestionForm (formdata=<object object>, **kwargs)

Form for creating or editing a question.

Includes fields for question type, text, options, and ranges.

:param formdata: Input data coming from the client, usually request.form or equivalent. Should provide a "multi dict" interface to get a list of values for a given key, such as what Werkzeug, Django, and WebOb provide. :param obj: Take existing data from attributes on this object matching form field attributes. Only used if formdata is not passed. :param prefix: If provided, all fields will have their name prefixed with the value. This is for distinguishing multiple forms on a single page. This only affects the HTML name for matching input data, not the Python name for matching existing data. :param data: Take existing data from keys in this dict matching form field attributes. obj takes precedence if it also has a matching attribute. Only used if formdata is not passed. :param meta: A dict of attributes to override on this form's :attr:meta instance. :param extra_filters: A dict mapping field attribute names to lists of extra filter functions to run. Extra filters run after filters passed when creating the field. If the form has filter_<fieldname>, it is the last extra filter. :param kwargs: Merged with data to allow passing existing data as parameters. Overwrites any duplicate keys in data. Only used if formdata is not passed.

Expand source code
class QuestionForm(FlaskForm):
    """
    Form for creating or editing a question.

    Includes fields for question type, text, options, and ranges.
    """
    q_type = SelectField("Question type")  # Dropdown for selecting question type
    text = StringField("Question")  # Field for question text
    position = IntegerField("Question number")  # Integer field for question number
    options = FieldList(FormField(AnswerOptions), min_entries=2, label="Answer Options")  # Field list for answer options
    ranges = FieldList(FormField(RangeOptions), min_entries=1, label="Range Options")  # Field list for range options
    submit = SubmitField("Create question")  # Submit button

Ancestors

  • flask_wtf.form.FlaskForm
  • wtforms.form.Form
  • wtforms.form.BaseForm

Class variables

var options
var position
var q_type
var ranges
var submit
var text
class RangeOptions (formdata=<object object>, **kwargs)

Form for defining range options for a question.

Includes fields for start value, end value, step, and text labels.

:param formdata: Input data coming from the client, usually request.form or equivalent. Should provide a "multi dict" interface to get a list of values for a given key, such as what Werkzeug, Django, and WebOb provide. :param obj: Take existing data from attributes on this object matching form field attributes. Only used if formdata is not passed. :param prefix: If provided, all fields will have their name prefixed with the value. This is for distinguishing multiple forms on a single page. This only affects the HTML name for matching input data, not the Python name for matching existing data. :param data: Take existing data from keys in this dict matching form field attributes. obj takes precedence if it also has a matching attribute. Only used if formdata is not passed. :param meta: A dict of attributes to override on this form's :attr:meta instance. :param extra_filters: A dict mapping field attribute names to lists of extra filter functions to run. Extra filters run after filters passed when creating the field. If the form has filter_<fieldname>, it is the last extra filter. :param kwargs: Merged with data to allow passing existing data as parameters. Overwrites any duplicate keys in data. Only used if formdata is not passed.

Expand source code
class RangeOptions(FlaskForm):
    """
    Form for defining range options for a question.

    Includes fields for start value, end value, step, and text labels.
    """
    start = IntegerField("Starting Value", default=0)  # Integer field for starting value
    stop = IntegerField("End Value", default=100)  # Integer field for end value
    step = DecimalField("Steps", default=1)  # Decimal field for step size
    start_text = StringField("Start Text")  # Field for start text
    stop_text = StringField("Stop Text")  # Field for stop text

Ancestors

  • flask_wtf.form.FlaskForm
  • wtforms.form.Form
  • wtforms.form.BaseForm

Class variables

var start
var start_text
var step
var stop
var stop_text
class StudyForm (formdata=<object object>, **kwargs)

Form for creating or editing a study.

Fields include study details, file uploads, search engines, classifiers, result types, and queries.

:param formdata: Input data coming from the client, usually request.form or equivalent. Should provide a "multi dict" interface to get a list of values for a given key, such as what Werkzeug, Django, and WebOb provide. :param obj: Take existing data from attributes on this object matching form field attributes. Only used if formdata is not passed. :param prefix: If provided, all fields will have their name prefixed with the value. This is for distinguishing multiple forms on a single page. This only affects the HTML name for matching input data, not the Python name for matching existing data. :param data: Take existing data from keys in this dict matching form field attributes. obj takes precedence if it also has a matching attribute. Only used if formdata is not passed. :param meta: A dict of attributes to override on this form's :attr:meta instance. :param extra_filters: A dict mapping field attribute names to lists of extra filter functions to run. Extra filters run after filters passed when creating the field. If the form has filter_<fieldname>, it is the last extra filter. :param kwargs: Merged with data to allow passing existing data as parameters. Overwrites any duplicate keys in data. Only used if formdata is not passed.

Expand source code
class StudyForm(FlaskForm):
    """
    Form for creating or editing a study.

    Fields include study details, file uploads, search engines, classifiers,
    result types, and queries.
    """
    id = HiddenField("Study ID", default=0)  # Hidden field for study ID
    name = StringField("Study name", [validators.InputRequired("Input required.")])  # Required study name
    description = TextAreaField("Description")  # Field for study description
    type = SelectField("Study type", coerce=int)  # Dropdown for selecting study type
    imported = BooleanField("Import own search results", default=False)  # Checkbox for importing search results
    imported_data = FileField("Add own search results (csv)")  # File upload for search results
    search_engines = MultiCheckboxField("Select search engines", coerce=int)  # Multiple checkbox field for search engines
    classifier = MultiCheckboxField("Select classifier", coerce=int)  # Multiple checkbox field for classifiers
    result_type = SelectField("Select result types", choices=[(1, "Organic Results"),
                                                               (2, "Snippets"),
                                                               (3, "Universal Search Results"),
                                                               (4, "Advertisements")], coerce=int)  # Dropdown for result types
    queries = TextAreaField("Queries (use new line for each query)", validators=[validators.Length(min=1, max=50000, message="Please enter at least one query.")])  # Text area for entering queries
    query_list = FileField("List of queries (csv)")  # File upload for list of queries
    task = StringField("Search Task (use *** as a placeholder for the query)", default="In the following, you see the results for the query ***. Please assess the results using the questions below.")  # Field for describing the search task
    result_count = IntegerField("Number of results to collect", default=10, validators=[validators.NumberRange(min=1, max=200, message="The number of results can be between 1 and 200.")])  # Integer field for specifying the number of results
    submit = SubmitField("Create study")  # Submit button

Ancestors

  • flask_wtf.form.FlaskForm
  • wtforms.form.Form
  • wtforms.form.BaseForm

Class variables

var classifier
var description
var id
var imported
var imported_data
var name
var queries
var query_list
var result_count
var result_type
var search_engines
var submit
var task
var type