q2_sdk.ui.fields
— Q2 Online compliant HTML elements
- 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_fieldslabel (
str
) – What the OnlineUser will seerequired (
bool
) – Adds validation and stylingvalue (
str
) – Starting textplaceholder (
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_fieldslabel (
str
) – What the OnlineUser will seechecked (
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_fieldslabel (
str
) – What the OnlineUser will seerequired (
bool
) – Adds validation and stylingvalue (
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 buttonslabel (
str
) – What the OnlineUser will seevalue (
str
) – Will be the value on POST calls in self.form_fieldsselected (
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 seespan_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_fieldslabel (
str
) – What the OnlineUser will seelist_of_options (
List
[SelectOption
]) – Select box Optionsrequired (
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_fieldslabel (
str
) – What the OnlineUser will seerequired – Adds validation and styling
- class q2_sdk.ui.fields.InternalLink(routing_key, label, target=None)[source]
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 attributelabel (
str
) – Link texttarget – Anchor tag target attribute
- class q2_sdk.ui.fields.ExternalLink(href, label, target='_blank')[source]
Bases:
BaseField
An anchor tag for navigating to an external location
- Parameters:
href (
str
) – Anchor tag href attribute, should be an external URLlabel (
str
) – Link texttarget – Anchor tag target attribute
- class q2_sdk.ui.fields.FormLink(form_id, label, target='')[source]
Bases:
BaseField
An anchor tag for navigating to another Q2Form
- Parameters:
form_id (
int
) – Q2_Form.form_id to redirect tolabel (
str
) – Link texttarget – 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 elementsgrid_size (
str
) – Can be either None, XS, S, M, L