canReturnSubmit

canReturnSubmit

RagnarGrootKoerkampRagnarGrootKoerkamp Posts: 48Questions: 14Answers: 1
edited December 2016 in Editor

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) {
                ...
            }

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    Do you mean that it should be allowed to be set to a boolean value as well as a function?

    Thanks,
    Allan

  • RagnarGrootKoerkampRagnarGrootKoerkamp Posts: 48Questions: 14Answers: 1

    Yes, that is indeed what I mean.

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    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

This discussion has been closed.