Skip to content

Commit

Permalink
fix problem with panel containers
Browse files Browse the repository at this point in the history
  • Loading branch information
cguardia committed Oct 6, 2023
1 parent bd70449 commit 72a8a7e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion questions/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,13 @@ def _add_elements(self, survey, form, top_level=False, container_name="questions
self._add_elements(page, element.form)
survey.pages.append(page)
elif isinstance(element, (FormPage, FormPanel)):
container = getattr(survey, container_name)
container = getattr(survey, container_name, None)
if container is None:
pages = survey.pages
if len(pages) > 0:
container = getattr(pages[0], container_name)
if container is None:
raise "Error in form definition: container not found."
if element.dynamic:
panel = PanelDynamicBlock(name=name, **element.params)
new_container_name = "template_elements"
Expand Down

0 comments on commit 72a8a7e

Please sign in to comment.