questions.templates module¶
- questions.templates.get_form_page(title='', html_id='questions_form', platform='jquery', survey_js='', js_resources=None, css_resources=None)[source]¶
Generate a standalone SurveyJS HTML page.
- Parameters:
title (
str
) – The form title to display.html_id (
str
) – The HTML id of the form placeholder.platform (
str
) – The name of the supported SurveyJS platform to use.survey_js (
str
) – The generated JS to put in the form.js_resources (
Optional
[List
]) – The list of JS resources to add to the HTMl head.css_resources (
Optional
[List
]) – The list of CSS resources to add to the HTMl head.
- Returns:
The rendered HTML as string.
- questions.templates.get_platform_js_resources(platform='jquery', resource_url='https://unpkg.com')[source]¶
Get the list of suggested JS resources for a platform. if not using the CDN, only the main SurveyJS JS file is returned.
- Parameters:
platform (
str
) – The name of the JS platform.resource_url (
str
) – The URL where all SurveyJS resources are located.
- Returns:
The list of resource URLs.
- questions.templates.get_survey_js(form_json='', form_data=None, html_id='questions_form', action='', theme='defaultV2', platform='jquery')[source]¶
Get the SurveyJS initialization script and form definition.
- Parameters:
form_json (
str
) – The JSON generated from the questions form.form_data (
Optional
[Dict
[str
,Any
]]) – Any form data to set on the rendered form.html_id (
str
) – The HTML id of the form placeholder.action (
str
) – The URL where the submitted form data will be posted.theme (
str
) – The name of the SurveyJS theme to use.platform (
str
) – The name of the supported SurveyJS platform to use.
- Returns:
The rendered JS as string.
- questions.templates.get_theme_css_resources(theme='defaultV2', resource_url='https://unpkg.com')[source]¶
Get the list of suggested CSS resources for a theme. if not using the CDN, or using an unsupported theme, only the main SurveyJS CSS file is returned.
- Parameters:
theme (
str
) – The name of the CSS theme.resource_url (
str
) – The URL where all SurveyJS resources are located.
- Returns:
The list of resource URLs.