canReturnSubmit
canReturnSubmit
RagnarGrootKoerkamp
Posts: 48Questions: 14Answers: 1
For consistency, it would be better if the canReturnSubmit
field option also accepts true
and false
as arguments.
Furthermore, I would prefer true
to be the default option:
- since that is the old (backwards compatible) behavior;
- only very rarely do I need to prevent enter (textarea, selectize button), while otherwise submitting on enter is fine.
Here is the code I am using now:
var submit = true;
//if(field.canReturnSubmit === true) submit = true;
if(field.canReturnSubmit === false) submit = false;
if( typeof field.canReturnSubmit === 'function'){
submit = field.canReturnSubmit( el );
}
if (submit === true) {
...
}
This discussion has been closed.
Replies
Do you mean that it should be allowed to be set to a boolean value as well as a function?
Thanks,
Allan
Yes, that is indeed what I mean.
function () { return true; }
seems fairly simple and it means there doesn't have to be any type handling code in Editor for this. However, I do take the point and simplicity is good! I've added it to my list.Thanks,
Allan