diff --git a/Form/WidgetFormQuestionType.php b/Form/WidgetFormQuestionType.php index 963428e..e9c7c90 100644 --- a/Form/WidgetFormQuestionType.php +++ b/Form/WidgetFormQuestionType.php @@ -92,9 +92,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'widget_form.form.question.alignment.left' => 'left', 'widget_form.form.question.alignment.right' => 'right', ], - 'data' => 'full', 'choices_as_values' => true, 'expanded' => true, + 'empty_data' => 'full', ] ); $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { diff --git a/Resources/views/formCreator.html.twig b/Resources/views/formCreator.html.twig index 72f0c31..fbe771d 100644 --- a/Resources/views/formCreator.html.twig +++ b/Resources/views/formCreator.html.twig @@ -7,7 +7,7 @@ {% endfilter %} {% endspaceless %}"> {% for question in form.questions %} -
  • +
  • diff --git a/Resources/views/new.html.twig b/Resources/views/new.html.twig index a751a46..14d47d4 100644 --- a/Resources/views/new.html.twig +++ b/Resources/views/new.html.twig @@ -4,7 +4,7 @@ {% set widgetId = widget.id|default('null') %} {% block form_static %} -
    +
    {{ form_start(form, {'attr' : {'id' : 'victoire_widget_form' }}) }}
    @@ -100,25 +100,25 @@ icon.closest( ".question" ).find( ".question-content" ).toggle(); }); }); - var questionHolder = $vic('ul#questions-form-list'); + var questionHolder{{ quantum }} = $vic('div[data-quantum="{{ quantum }}"].vic-tab-pane ul#questions-form-list'); + var $addQuestionLink = $vic('{{ "widget_form.form.question.new.label"|trans|raw }}'); - var $newQuestionLinkLi = $vic('
  • ').append($addQuestionLink); + var $newQuestionLinkLi{{ quantum }} = $vic('
  • ').append($addQuestionLink); var targetOnOff = {{ form.autoAnswer.vars.checked == 'on' ? "true" : "false" }}; $vic(document).ready(function() { - questionHolder.find('li.question').each(function() { + questionHolder{{ quantum }}.find('li.question').each(function() { var id = $vic(this).data('id'); showQuestionForm(id); addQuestionFormDeleteLink($vic(this)); $vic(this).find('.question-position').val($vic('li.question').index($vic(this))); $vic(this).find('.selector-type').attr('onChange', 'showQuestionForm(this)'); }); - questionHolder.append($newQuestionLinkLi); - + questionHolder{{ quantum }}.append($newQuestionLinkLi{{ quantum }}); $addQuestionLink.on('click', function(e) { e.preventDefault(); - addQuestionForm(questionHolder, $newQuestionLinkLi); + addQuestionForm(questionHolder{{ quantum }}, $newQuestionLinkLi{{ quantum }}); }); });