1

This textarea is one that is updated several times and each line in the textarea is for a separate entry. Thus it is better to have each starting at the very left of the textbox.


For example what i want is,


Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo.


But what it is displaying is,


_____(whitespace)_________________Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo.

This happens even though when I type in the textarea to save I do it all the way to the left. How do I get around this so that It only displays to the far left for each line?

This is my code:

                <div class="col my-2 w-1/6">
                    
                    <p class="md:text-center">Notes</p>
                    <textarea id="loc_notes" cols="30" rows="10" style = "font-size: 12px;width:100%" class="mx-1 border-2 border-black" name="location_notes">
                        @foreach($notes as $note)    
                            {{$note->my_notes}}
                        @endforeach
                    </textarea>
                </div>
  • Have you tried adding a linebreak after each iteration? – Rob Moll Jul 27 '21 at 13:13
  • Your question is a little unclear.. Are you referring to the empty space at the start of the sentence? – user3532758 Jul 27 '21 at 13:19
  • Yes a empty space shows up at the start of the first line per entry. Its about the size of a few tabs. – Daniel Burgess Jul 27 '21 at 13:23
  • Yeah this *probably* is a bug in blade engine. Try putting everything inside textarea in a single line without any spaces to see if it works.. no promises though. As in.. `name="location_notes">@foreach($notes as $note){{$note->my_notes}}@endforeach ` – user3532758 Jul 27 '21 at 13:47

1 Answers1

0

The question is a little unclear for me but I think you want to get from this:

first entry second entry

To this:

first entry 
second entry

The way you are looping through $notes then it doesn't know that you want a carriage return after each note, to get them lining up on the left.

To get the carriage return add &#13;&#10; after each echo of the note, like this:

@foreach($notes as $note)    
    {{ $note->my_notes }} &#13;&#10;
@endforeach

See here for more details on new lines/ carriage returns in textareas.

Edit

You question is clearer now. You are getting the whitespace because of the formatting in your blade file. Change this:

<textarea>
   @foreach($notes as $note)    
        {{$note->my_notes}}
   @endforeach
</textarea>

To this (all whitespace taken out):

<textarea>@foreach($notes as $note){{ $note->my_notes }}@endforeach</textarea>
forrestedw
  • 366
  • 3
  • 16