q2_sdk.ui.fields — Q2 Online compliant HTML elements

class q2_sdk.ui.fields.BaseField[source]

Bases: object

serialize()[source]

Generates Q2 compliant html

class q2_sdk.ui.fields.InputField(name, label, required=False, value='', placeholder='')[source]

Bases: BaseField

Q2 styled Input field

Parameters:
  • name (str) – Will be the key on POST calls in self.form_fields

  • label (str) – What the OnlineUser will see

  • required (bool) – Adds validation and styling

  • value (str) – Starting text

  • placeholder (str) – Hint text

class q2_sdk.ui.fields.CheckboxField(name, label, checked=False)[source]

Bases: InputField

Q2 Styled Checkbox field

Parameters:
  • name (str) – Will be the key on POST calls in self.form_fields

  • label (str) – What the OnlineUser will see

  • checked (bool) – If True, Checkbox will start already checked

class q2_sdk.ui.fields.PhoneField(name, label, required=False, value='')[source]

Bases: InputField

Q2 Styled Phone field

Parameters:
  • name (str) – Will be the key on POST calls in self.form_fields

  • label (str) – What the OnlineUser will see

  • required (bool) – Adds validation and styling

  • value (str) – Starting text

class q2_sdk.ui.fields.RadioButton(name, label, value, selected=False)[source]

Bases: InputField

Q2 Styled Radio Button

Parameters:
  • name (str) – Will be the key on POST calls in self.form_fields. This should be the same for shared radio buttons

  • label (str) – What the OnlineUser will see

  • value (str) – Will be the value on POST calls in self.form_fields

  • selected (bool) – If True, RadioButton will start already selected

class q2_sdk.ui.fields.SpanField(text, span_id=None)[source]

Bases: BaseField

Q2 styled Span field

Parameters:
  • text (str) – What the OnlineUser will see

  • span_id – (Optional) Hardcode the span ID instead of generating one

class q2_sdk.ui.fields.SelectOption(key, value, selected=False)[source]

Bases: object

To be provided as a list to Instances of SelectField

class q2_sdk.ui.fields.SelectField(name, label, list_of_options, required=False)[source]

Bases: BaseField

Q2 styled Select field

Parameters:
  • name (str) – Will be the key on POST calls in self.form_fields

  • label (str) – What the OnlineUser will see

  • list_of_options (List[SelectOption]) – Select box Options

  • required (bool) – Adds validation and styling

class q2_sdk.ui.fields.CalendarPickerField(name, label, required=False)[source]

Bases: BaseField

Q2 styled Calendar field

Parameters:
  • name (str) – Will be the key on POST calls in self.form_fields

  • label (str) – What the OnlineUser will see

  • required – Adds validation and styling

Bases: BaseField

An anchor tag for navigating to a different route within the extension

Parameters:
  • routing_key (str) – Routing key for internal link route target, fills href attribute

  • label (str) – Link text

  • target – Anchor tag target attribute

Bases: BaseField

An anchor tag for navigating to an external location

Parameters:
  • href (str) – Anchor tag href attribute, should be an external URL

  • label (str) – Link text

  • target – Anchor tag target attribute

Bases: BaseField

An anchor tag for navigating to another Q2Form

Parameters:
  • form_id (int) – Q2_Form.form_id to redirect to

  • label (str) – Link text

  • target – Anchor tag target attribute

class q2_sdk.ui.fields.Row(list_of_fields, grid_size=None)[source]

Bases: BaseField

Takes a dynamic list of fields and renders appropriate grid using Javascript Bootstrap (http://getbootstrap.com/javascript/#modals-grid-system)

Parameters:
  • list_of_fields (List[BaseField]) – List of instantiated BaseField elements

  • grid_size (str) – Can be either None, XS, S, M, L