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.formor 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 ifformdatais 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.objtakes precedence if it also has a matching attribute. Only used ifformdatais not passed. :param meta: A dict of attributes to override on this form's :attr:metainstance. :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 hasfilter_<fieldname>, it is the last extra filter. :param kwargs: Merged withdatato allow passing existing data as parameters. Overwrites any duplicate keys indata. Only used ifformdatais 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 buttonAncestors
- flask_wtf.form.FlaskForm
- wtforms.form.Form
- wtforms.form.BaseForm
Class variables
var likert_scalevar long_textvar multiple_choicevar scale_numbervar short_textvar skipvar submitvar 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.formor 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 ifformdatais 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.objtakes precedence if it also has a matching attribute. Only used ifformdatais not passed. :param meta: A dict of attributes to override on this form's :attr:metainstance. :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 hasfilter_<fieldname>, it is the last extra filter. :param kwargs: Merged withdatato allow passing existing data as parameters. Overwrites any duplicate keys indata. Only used ifformdatais 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 labelAncestors
- flask_wtf.form.FlaskForm
- wtforms.form.Form
- wtforms.form.BaseForm
Class variables
var labelvar 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.formor 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 ifformdatais 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.objtakes precedence if it also has a matching attribute. Only used ifformdatais not passed. :param meta: A dict of attributes to override on this form's :attr:metainstance. :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 hasfilter_<fieldname>, it is the last extra filter. :param kwargs: Merged withdatato allow passing existing data as parameters. Overwrites any duplicate keys indata. Only used ifformdatais 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 buttonAncestors
- flask_wtf.form.FlaskForm
- wtforms.form.Form
- wtforms.form.BaseForm
Class variables
var datavar 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.formor 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 ifformdatais 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.objtakes precedence if it also has a matching attribute. Only used ifformdatais not passed. :param meta: A dict of attributes to override on this form's :attr:metainstance. :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 hasfilter_<fieldname>, it is the last extra filter. :param kwargs: Merged withdatato allow passing existing data as parameters. Overwrites any duplicate keys indata. Only used ifformdatais 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 buttonAncestors
- flask_wtf.form.FlaskForm
- wtforms.form.Form
- wtforms.form.BaseForm
Class variables
var emailvar messagevar namevar 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.formor 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 ifformdatais 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.objtakes precedence if it also has a matching attribute. Only used ifformdatais not passed. :param meta: A dict of attributes to override on this form's :attr:metainstance. :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 hasfilter_<fieldname>, it is the last extra filter. :param kwargs: Merged withdatato allow passing existing data as parameters. Overwrites any duplicate keys indata. Only used ifformdatais 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 buttonAncestors
- flask_wtf.form.FlaskForm
- wtforms.form.Form
- wtforms.form.BaseForm
Class variables
var commentvar statusvar 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.formor 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 ifformdatais 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.objtakes precedence if it also has a matching attribute. Only used ifformdatais not passed. :param meta: A dict of attributes to override on this form's :attr:metainstance. :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 hasfilter_<fieldname>, it is the last extra filter. :param kwargs: Merged withdatato allow passing existing data as parameters. Overwrites any duplicate keys indata. Only used ifformdatais 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 buttonAncestors
- flask_wtf.form.FlaskForm
- wtforms.form.Form
- wtforms.form.BaseForm
Class variables
var submitvar 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.formor 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 ifformdatais 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.objtakes precedence if it also has a matching attribute. Only used ifformdatais not passed. :param meta: A dict of attributes to override on this form's :attr:metainstance. :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 hasfilter_<fieldname>, it is the last extra filter. :param kwargs: Merged withdatato allow passing existing data as parameters. Overwrites any duplicate keys indata. Only used ifformdatais 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 usersAncestors
- flask_wtf.form.FlaskForm
- wtforms.form.Form
- wtforms.form.BaseForm
Class variables
var newvar 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.formor 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 ifformdatais 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.objtakes precedence if it also has a matching attribute. Only used ifformdatais not passed. :param meta: A dict of attributes to override on this form's :attr:metainstance. :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 hasfilter_<fieldname>, it is the last extra filter. :param kwargs: Merged withdatato allow passing existing data as parameters. Overwrites any duplicate keys indata. Only used ifformdatais 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 buttonAncestors
- flask_wtf.form.FlaskForm
- wtforms.form.Form
- wtforms.form.BaseForm
Class variables
var countriesvar descriptionvar interval_frequencyvar interval_modevar namevar queriesvar result_countvar result_typevar 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
validateis called. :param filters: A sequence of callable which are run by :meth:~Field.processto filter or transform the input data. For exampleStringForm(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
_formisn't provided, an :class:UnboundFieldwill be returned instead. Call its :func:bindmethod 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_widgetvar 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.formor 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 ifformdatais 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.objtakes precedence if it also has a matching attribute. Only used ifformdatais not passed. :param meta: A dict of attributes to override on this form's :attr:metainstance. :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 hasfilter_<fieldname>, it is the last extra filter. :param kwargs: Merged withdatato allow passing existing data as parameters. Overwrites any duplicate keys indata. Only used ifformdatais 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 buttonAncestors
- flask_wtf.form.FlaskForm
- wtforms.form.Form
- wtforms.form.BaseForm
Class variables
var passwordvar submitvar 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.formor 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 ifformdatais 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.objtakes precedence if it also has a matching attribute. Only used ifformdatais not passed. :param meta: A dict of attributes to override on this form's :attr:metainstance. :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 hasfilter_<fieldname>, it is the last extra filter. :param kwargs: Merged withdatato allow passing existing data as parameters. Overwrites any duplicate keys indata. Only used ifformdatais 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 buttonAncestors
- flask_wtf.form.FlaskForm
- wtforms.form.Form
- wtforms.form.BaseForm
Class variables
var optionsvar positionvar q_typevar rangesvar submitvar 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.formor 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 ifformdatais 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.objtakes precedence if it also has a matching attribute. Only used ifformdatais not passed. :param meta: A dict of attributes to override on this form's :attr:metainstance. :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 hasfilter_<fieldname>, it is the last extra filter. :param kwargs: Merged withdatato allow passing existing data as parameters. Overwrites any duplicate keys indata. Only used ifformdatais 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 textAncestors
- flask_wtf.form.FlaskForm
- wtforms.form.Form
- wtforms.form.BaseForm
Class variables
var startvar start_textvar stepvar stopvar 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.formor 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 ifformdatais 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.objtakes precedence if it also has a matching attribute. Only used ifformdatais not passed. :param meta: A dict of attributes to override on this form's :attr:metainstance. :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 hasfilter_<fieldname>, it is the last extra filter. :param kwargs: Merged withdatato allow passing existing data as parameters. Overwrites any duplicate keys indata. Only used ifformdatais 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 buttonAncestors
- flask_wtf.form.FlaskForm
- wtforms.form.Form
- wtforms.form.BaseForm
Class variables
var classifiervar descriptionvar idvar importedvar imported_datavar namevar queriesvar query_listvar result_countvar result_typevar search_enginesvar submitvar taskvar type