Click here to Skip to main content
15,314,714 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
methods: {
updatePreContent () {
let name_str = 'Eng name: ' + this.engineer_name
let start_str = 'Booking Start Time: ' + this.start_date + ' ' + this.start_hours + ':' + this.start_minutes
let end_str = 'Booking End Time: ' + this.end_date + ' ' + this.end_hours + ':' + this.end_minutes

this.notes_description = name_str + "\n" + start_str + "\n" + end_str + "\n"

I have a form with starting date ,ending date and textarea. I can select the starting date and I made it autopopulate in the textarea. When I type new input in the textarea and change the starting date, the value which I typed in the textarea is getting disappear . how to set that input in the textarea even if i change the date??

What I have tried:

<div class="form-group">
           <label class="col-md-3 control-label">{{trans('wo.notes_description') }}:
    <div class="col-md-9">
       <textarea  v-model="notes_description" class="form-control" id="startDate">  
        {{-- Form::textarea('resolution_notes_diagnostics', ($item->resolution_repair)?$item->resolution_repair->resolution_notes:null, ['id' =>'resolution_notes_diagnostics', 'class' => 'form-control','rows' => '3']) --}}
Updated 6-May-21 6:14am

1 solution

When you change the input date it updates the text area. It does this by replacing whatever is in the text area with your update - so it disappears.

What you need to do is update the text are with a combination of what was in it and your new value from the date update. This means changing your date-insertion script.

something like:
textObj =document.getElementbyId('startDate');

textObj.value = textObj.value + ' ' + the_new_start_date;


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900