Disable submit on enter press in input LS3

Mehr
1 Woche 4 Tage her - 1 Woche 4 Tage her #181639 von andrescevp
COM_KUNENA_MESSAGE_CREATED_NEW
Hi people!

I has been crazy looking for a solution, but I can't...

Well, the thing is, that I have some selects that are handled by Select2.

It works, no problem.

I has been enabled the feature of tagging to can write free text, the point is that Select2 displys and searcher field to search options, when find your option then you can do click to select... or press enter (witch is the normal).

The problem is... when you press enter the form is submitted and do not want this.

Some way to prevent this?

I'm using limesurvey 3.

And yes, I check the workaround and was trying to do it myself... but I just can't find the proper way.

Thanks!
Last edit: 1 Woche 4 Tage her by andrescevp.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

LimeSurvey Partners
Mehr
1 Woche 4 Tage her #181644 von jelo
COM_KUNENA_MESSAGE_REPLIED_NEW

andrescevp schrieb: Well, the thing is, that I have some selects that are handled by Select2.

You seem to use somekind of workaround. Select2 is what?

You should provide the exact version of LimeSurvey and the theme used for the survey.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Woche 4 Tage her #181645 von andrescevp
COM_KUNENA_MESSAGE_REPLIED_NEW
LimerSurvey 3.1

Select2 is a library to dynamize select ( select2.org/ )

template vanilla

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Woche 4 Tage her #181648 von andrescevp
COM_KUNENA_MESSAGE_REPLIED_NEW
I checked and doing this will remove the autosubmit on enter

ajaxHandler.unsetSubmit();

But keep doing validations and of course fail

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Woche 4 Tage her #181652 von andrescevp
COM_KUNENA_MESSAGE_REPLIED_NEW
sadly was a fake hype hahaha

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Woche 3 Tage her #181663 von DenisChenu
COM_KUNENA_MESSAGE_REPLIED_NEW
Maybe gitlab.com/SondagesPro/SurveyThemes/skel.../skelvanilla.js#L114

Because submit current form when using enter on a dropdown or a text input is the default behaviour of the browser.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Woche 3 Tage her #181741 von andrescevp
COM_KUNENA_MESSAGE_REPLIED_NEW
thanks.

I notice that limesurvey is triggering the enter key twice...
                $(document).on('keypress keyup keydown', '#limesurvey input[type=text],#limesurvey input[type=search],#limesurvey select,#limesurvey .select2-results__option',function(e){
                    var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
                    console.log(key);
                    if (key == 13 && e.ctrlKey != true ) {
                        cancelEvent(e);
                        var inputs = $(this).closest('form').find(':input:visible:enabled,select:visible:enabled,textarea:visible:enabled,button:visible:enabled');
                        if ((inputs.length-1) == inputs.index(this)) {
                            console.log('submit!');
                            $('.ls-move-submit-btn').focus();
                            return;
                        } else {
                            console.log('next!');
                            var nextElement = inputs.eq(inputs.index(this) + 1);
                            if ($(nextElement).data('select2')) {
                                $(nextElement).select2('open');
                                return false;
                            }
                            nextElement.focus();
                            return;
                        }
 
                        return false;
                    }
                });
 


console log:
index.php?r=survey/index&sid=939187:1441 100
index.php?r=survey/index&sid=939187:1441 65
index.php?r=survey/index&sid=939187:1441 97
index.php?r=survey/index&sid=939187:1441 83
index.php?r=survey/index&sid=939187:1441 115
index.php?r=survey/index&sid=939187:1441 68
index.php?r=survey/index&sid=939187:1441 83
index.php?r=survey/index&sid=939187:1441 65
index.php?r=survey/index&sid=939187:1441 68
index.php?r=survey/index&sid=939187:1441 100
index.php?r=survey/index&sid=939187:1441 65
index.php?r=survey/index&sid=939187:1441 97
index.php?r=survey/index&sid=939187:1441 83
index.php?r=survey/index&sid=939187:1441 115
2index.php?r=survey/index&sid=939187:1441 68
index.php?r=survey/index&sid=939187:1441 100
index.php?r=survey/index&sid=939187:1441 83
index.php?r=survey/index&sid=939187:1441 65
index.php?r=survey/index&sid=939187:1441 68
index.php?r=survey/index&sid=939187:1441 13
index.php?r=survey/index&sid=939187:1450 next!
index.php?r=survey/index&sid=939187:1441 13
index.php?r=survey/index&sid=939187:1446 submit!

some idea?

it do not stop the propagation... something to do with Pjax?

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Woche 3 Tage her #181743 von DenisChenu
COM_KUNENA_MESSAGE_REPLIED_NEW

andrescevp schrieb: thanks.


it do not stop the propagation... something to do with Pjax?

I don't know … first things i do whan something don't work is disable ajaxMode (even if all work in fact …).

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Woche 3 Tage her #181746 von andrescevp
COM_KUNENA_MESSAGE_REPLIED_NEW
this did the trick. Thanks.

But anyway... weird bug.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
1 Woche 2 Tage her #181771 von DenisChenu
COM_KUNENA_MESSAGE_REPLIED_NEW

andrescevp schrieb: this did the trick. Thanks.

But anyway... weird bug.

bugs.limesurvey.org/view.php?id=14616 :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha