- Posts: 6
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Disable submit on enter press in input LS3
- andrescevp
- Topic Author
- Offline
- New Member
Less
More
5 years 2 weeks ago - 5 years 2 weeks ago #181639
by andrescevp
Disable submit on enter press in input LS3 was created by andrescevp
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!
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: 5 years 2 weeks ago by andrescevp.
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5070
- Thank you received: 1263
5 years 2 weeks ago #181644
by jelo
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
Replied by jelo on topic Disable submit on enter press in input LS3
You seem to use somekind of workaround. Select2 is what?andrescevp wrote: Well, the thing is, that I have some selects that are handled by Select2.
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
The topic has been locked.
- andrescevp
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
5 years 2 weeks ago #181645
by andrescevp
Replied by andrescevp on topic Disable submit on enter press in input LS3
The topic has been locked.
- andrescevp
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
5 years 2 weeks ago #181648
by andrescevp
Replied by andrescevp on topic Disable submit on enter press in input LS3
I checked and doing this will remove the autosubmit on enter
ajaxHandler.unsetSubmit();
But keep doing validations and of course fail
ajaxHandler.unsetSubmit();
But keep doing validations and of course fail
The topic has been locked.
- andrescevp
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
5 years 2 weeks ago #181652
by andrescevp
Replied by andrescevp on topic Disable submit on enter press in input LS3
sadly was a fake hype hahaha
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
5 years 2 weeks ago #181663
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Disable submit on enter press in input LS3
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.
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 , plugin development .
I don't answer to private message.
The topic has been locked.
- andrescevp
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
5 years 2 weeks ago #181741
by andrescevp
Replied by andrescevp on topic Disable submit on enter press in input LS3
thanks.
I notice that limesurvey is triggering the enter key twice...
console log:
some idea?
it do not stop the propagation... something to do with Pjax?
I notice that limesurvey is triggering the enter key twice...
Code:
$(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:
Code:
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?
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
5 years 2 weeks ago #181743
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Disable submit on enter press in input LS3
I don't know … first things i do whan something don't work is disable ajaxMode (even if all work in fact …).andrescevp wrote: thanks.
…
it do not stop the propagation... something to do with Pjax?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- andrescevp
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
5 years 2 weeks ago #181746
by andrescevp
Replied by andrescevp on topic Disable submit on enter press in input LS3
this did the trick. Thanks.
But anyway... weird bug.
But anyway... weird bug.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
5 years 1 week ago #181771
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Disable submit on enter press in input LS3
bugs.limesurvey.org/view.php?id=14616 :)andrescevp wrote: this did the trick. Thanks.
But anyway... weird bug.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.