I have a form where I used the following code to prevent the return key, which works as expected.
view laravel (blade template)
{!! Form::open(['route' => 'orders.store', 'onkeypress' => 'return event.keyCode != 13;']) !!}
compiles to html
<form method="POST" action="http://ift.tt/20HyfsE"
accept-charset="UTF-8"
onkeypress="return event.keyCode != 13;">
Now I have the circumstance, that I need the return key available in my textarea field. Expect this textarea field the behavious should be as before (prevent return key)
I tried to accomplish that, but struggle. Heres my last not working result:
view laravel (blade template)
{!! Form::open(['route' => 'orders.store', 'onkeypress' => 'return (( event.keyCode != 13 ) && $("note").is( ":focus") );']) !!}
// ...
{!! Form::textarea('note', null, ['class' => 'form-control', 'wrap' => 'physical']) !!}
compiles to html
<form method="POST" action="http://ift.tt/20HyfsE"
accept-charset="UTF-8"
onkeypress="return (( event.keyCode != 13 ) && $("note").is( ":focus") );">
<!-- ... -->
<textarea class="form-control" wrap="physical" name="note" cols="50" rows="10" id="note"></textarea>
Any hints how I can get the return key in the textarea, but still avoid the return key in the input fields?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire