Commit e8085c93 authored by Alper Akgun's avatar Alper Akgun Committed by Phil Hughes

Invalid trial form does not remember the user and country fields

parent e14a7597
import $ from 'jquery';
import axios from '~/lib/utils/axios_utils';
import { __ } from '~/locale';
import Flash from '~/flash';
document.addEventListener('DOMContentLoaded', () => {
const selectElement = document.getElementById('country_select');
const { countriesEndPoint } = selectElement.dataset;
const { countriesEndPoint, selectedOption } = selectElement.dataset;
axios
.get(countriesEndPoint)
......@@ -17,6 +18,9 @@ document.addEventListener('DOMContentLoaded', () => {
selectElement.appendChild(option);
});
$(selectElement)
.val(selectedOption)
.trigger('change.select2');
})
.catch(() => new Flash(__('Error loading countries data.')));
});
......@@ -20,10 +20,10 @@
= text_field_tag :phone_number, params[:phone_number], class: 'form-control', required: true
.form-group
= label_tag :number_of_users, _('How many users will be evaluating the trial?'), for: :number_of_users, class: 'col-form-label'
= number_field_tag :number_of_users, nil, class: 'form-control', required: true, min: 1
= number_field_tag :number_of_users, params[:number_of_users], class: 'form-control', required: true, min: 1
.form-group
= label_tag :country, _('Country'), class: 'col-form-label'
= select_tag :country, options_for_select([[_('Please select a country'), '']]), class: 'select2', required: true, id: 'country_select', data: { countries_end_point: countries_path }
= select_tag :country, options_for_select([[_('Please select a country'), '']]), class: 'select2', required: true, id: 'country_select', data: { countries_end_point: countries_path, selected_option: params[:country]}
= submit_tag _('Continue'), class: 'btn btn-success btn-block'
= render 'skip_trial'
---
title: Invalid trial form to remember user & country
merge_request: 21840
author:
type: fixed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment