inline editing not submitting on pressing enter key
inline editing not submitting on pressing enter key
hello
i am using chosen plugin and when i select anything from dropdown and click enter button its not submitting the data.
i have tried with select2 and selectize but its not submitting
note: it have just updated editor and its not working. it was working fine before update
This discussion has been closed.
Replies
Hi,
What version of Editor were you using before please? Are you using 1.7.1 now?
Do you have a link to the page that I can take a look at?
Thanks,
Allan
I am having this problem as well. After upgrading to 1.7.0 and now 1.7.2 when using select2 as part of an inline edit it does not submit either on enter or on selection with the mouse. The drop down will close but sits active and I have to manually "blur" away with tab or mouse click on another field or elsewhere on the page for it to submit.
Unfortunately I don't have a page to link you.
Speaking of select2 field type plugin can you bring back a version number in the source? (I thought it used to display a version when it was part of the download builder?) This way we can know when it is updated
Better version control for the plug-ins is a good idea - thanks!
Recently I added this to the Select2 integration:
That is probably what is causing the problem. The reason that was added was to allow multiple items to be selected from Select2 when inline editing (previously it was blurring immediately when selecting an item).
Could you confirm if that code is present in the Select2 Editor integration you are using? Could you also show me your Editor field configuration for the field? It might be that the above should only activate if Select2's multi-select / tags feature is enabled.
Regards,
Allan
Hi Allan,
I have checked the version of the select2 plugin I was using and I am pretty sure it did not have the code you showed above. I tried updating to the latest select2 plugin code with no success
My editor field configuration is pretty basic:
The following code from the select2 plugin fires when a selection is made from the dropdown
but it seems like it never bubbles up to the editor itself as none of the editor events seem to go off e.g
preBlur
orclose
.I have tried restoring older versions of my code but still cannot get it to operate properly so I am thinking it must be something wrong in my teams code
I will try to do some more debugging tomorrow and let you know if I find anything
I've just been looking into this as well, and Select2 with a single select behaves the same way as
select
: example.If you want to automatically submit when an item is selected, I think you'd need to add an event listener for that to call
submit()
.Perhaps it should be that in inline mode, both the select and select2 field types should submit if there can only be one selection. Open to feedback on this!
Allan
Hmmm I could have sworn it was submitting before! I thought I was going mad but if this is how it has always been then maybe I am.
The one difference with the ordinary select vs select2 is that when I hit enter on the field it submits but it doesn't appear to do that with select2? Maybe select2 is capturing the enter.
I'd be all for that being the default. Or even a boolean option to turn it on and off?
What is the best way to attach event listeners to the select2 created by the editor then without editing the select2 plugin?
That's interesting. What browser are you using? With Chrome the return key shows me the list (I would have sworn that it didn't before...!).
Use
editor.field( 'myFieldName' ).inst()
to get the Select2 instance orfield().input()
to get the input element.Allan
I am using Chrome (64.0.3282.140)...
I think we can put this to rest now... I'll just have to accept that it probably was never submitting the field on selecting an option (even though I was so sure )
Thanks heaps for your help
I am facing another scenario in connection with above discussion.
In Editor Window if I Press Enter Key in "Select2" Field Type Control, the Editor Window gets Submitted.
The formOptions:{main:{submitOnReturn:false}} is working fine for field type such as input field, textarea. However it does not seem to apply for Select2 control.
How can I prevent / disable "submitOnReturn" for Select2 Control?
The plug-ins can have a
canReturnSubmit
function. For what you want you would have that functionreturn false;
.Allan
Yes, that is exactly what I tried allan, and after incorporating canReturnSubmit in select2 plugin code, the code detects the event however for some reason, it still gets dismissed, It appeared like the canReturnSubmit code got detected after the Editor window dismissed. Something is overriding
This is the code I had incorporated in canReturnSubmit in select2 plugin
canReturnSubmit: function(conf,dt){
return false;
},
Not sure what to assign for dt, which is supposed to represent the node upon which the return key was triggered.
I've just tried adding:
to my local Select2 demo and it appears to work okay (i.e. doesn't submit). I did initially have KeyTable enabled which caused issues (changing focus of the cells), but disabling that allows it to work okay.
This is the configuration I was using for the field:
What options are you using yourself?
Allan
allan, Thanks for trying and updating the status. I had also used similar options. After confirmation from your end I checked my code in detail.
canReturnSubmit is working perfectly fine. Problem was elsewhere.
Old Code
< script >
var editor;
$(document).ready(function(){editor=new .........
New Code
< script >
$(document).ready(function(){var editor=new .........
By the way, allan, dataTables and Editor are simply awesome, it is beautiful. Special Thanks for you!
Thank you .
Hi everybody,
i'm having the same problem: can't submit a select2 field change by pressing enter on my keyboard. It will open the options list instead submit.
I've tried to add in editor.select2.js file
canReturnSubmit: function(conf,dt){
return false;
}
and also:
def: undefined
but it wan't work.
If I leave
onBlur: 'submit'
when I click on the select (after inline editing has been activated) a submit will start. When I then select an item from the list of options and click on another column, a second submission starts. That's strangeYou need to have the
canReturnSubmit
function returntrue
if you want the return key to be able to submit.Allan