Skip Navigation

[Resolved] Not save select field values when i submit the Event form

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user had some custom code on their site that was breaking our checkbox options.

Solution:

Unfortunately we are not able to fix custom coding.
However what you can do is to ask for help from one of the registered contractors who specialise in these kind of work for assistance.
https://toolset.com/contractors/

This support ticket is created 5 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 7 replies, has 2 voices.

Last updated by William Locatelli 5 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#1108391

I created a form for add a new Evento (CPT).
Save correctly all fields except selects.

Is a production site.

#1108408

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi William,

Thank you for contacting our support forum.

Could you send me a link to the page where i can see this issue ?

Thanks,
Shane

#1108410
Schermata 2018-09-14 alle 17.43.39.png
Schermata 2018-09-14 alle 17.43.48.png

Sure.
The post is a draft. hidden link

#1108502

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi William,

I see the issue.

Could you try temporarily disabling all the non-toolset plugins and submitting the form again ?

You form seems to be setup correctly.

Thanks,
Shane

#1108777

Hi Shane,
I made a backup and on the local installation I disabled all the plugins but nothing changed.

I also tried to change theme with default wordpress theme and it works!

So i think there is in my original theme some code (maybe js/jquery) that broke something. Can you focused on that?

Thank you

#1108786

I have found the code that generate the error but i don't understand how to fix it.

  var stm_select_style = function stm_select_style() {
        var select = $('select').not('.no_wrap, ' + '[multiple]');

        select.each(function () {
            var select = $(this);

            var options = select.find('option');
            var values = [];
            options.each(function (v, k) {
                values.push($(k).text());
            });
            var choicesList = '<ul class="stm_select__dropdown">';
            values.forEach(function (v) {
                choicesList += '<li><span>' + v + '</span></li>';
            });
            choicesList += '</ul>';
            var wrapperStructure = '<div class="stm_select"></div>';
            var wrapper = select.wrap(wrapperStructure).parent();
            var selectVal = $('<span class="stm-select__val"></span>').appendTo(wrapper);
            choicesList = $(choicesList).appendTo(wrapper);
            choicesList.find('li').click(function (e) {
                e.stopPropagation();
                var choice = $(this).text();
                selectVal.text(choice);
                select.val(choice);
                select.find('option').remove();
                select.append('<option value="' + choice + '" selected>');
                select.trigger('change');
                wrapper.removeClass('open');
            });


            $('.stm-select__val').on('click', function (el) {
                el.stopPropagation();
                $(this).find('option').remove();
                $(this).closest('.stm_select').addClass('open');
            });

            $('body').on('click', function (e) {
                wrapper.removeClass('open');
            });
            selectVal.text(select.find('option:selected').text());
        });

        $(document).on('change', select, function (e) {
        });
    };
#1109483

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi William,

This actually seems like some custom code. Unfortunately as this is not a part of our plugin i'm not able to take a look to fix this issue.

However what you can do is to ask for help from one of the registered contractors who specialise in these kind of work for assistance.
https://toolset.com/contractors/

Thanks,
Shane

#1110239

Thanks Shane 🙂

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.