-
Notifications
You must be signed in to change notification settings - Fork 778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
preventSubmitOnEnter only for textarea #415
Labels
Comments
Here is my solution, in case anyone is interested. I updated line 4527, from: // prevent textarea line breaks
if (event.keyCode == cf.Dictionary.keyCodes["enter"] && !event.shiftKey) {
event.preventDefault();
} to: // prevent textarea line breaks, but not in textareas with `rows` > 1
if (event.keyCode == cf.Dictionary.keyCodes["enter"] && !(this.inputElement.hasAttribute('rows') && parseInt(this.inputElement.getAttribute('rows')) > 1)) {
event.preventDefault();
} line 4579, from: if (this.cfReference.preventSubmitOnEnter === true) to: if (this.cfReference.preventSubmitOnEnter === true || this._currentTag.type == 'textarea') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I already bent my head around this problem but found no satisfying solution.
I would like my users to be able to submit an input element by hitting enter. But I also want them to be able to create new lines in textareas. Seems that this is not possbile at the same time.
Yes, it is possible to create a new line in a textarea by hitting
shift + enter
. But this is not a known feature amongst the average internet users. Plus it's impossbile on a touch device.Can I set
preventSubmitOnEnter
just for textareas?The text was updated successfully, but these errors were encountered: