Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

Is there an event to update the text when user types in textbox?

We had a coworker who was fired moths ago. We have a problem with his code. We don't know Handlebars.js

This is the code. You see that {{remarkText}}. Page loads. There's text in there. User adds to the text. Clicks "save" but the new text doesn't get saved. Only what was previously in there gets saved.

User has to actually delete using that "newRemarkDelete-{{remarkId}} and re-enter everything.

I can post the entire javascript too, if helpful

<script id="remarkTemplate" type="text/x-handlebars-template">
{{#each remarks}}
	{{#if sectionName}}
	<div id="newRemark-{{remarkId}}" class="row bg-success centered-rounded-80pct clearfix" data-remark-id="{{remarkId}}">
		<div class="pull-left">
			<div class="pull-left remark-section-name">Section: {{sectionName}}</div>
			<textarea id="newRemarkText-{{remarkId}}" name="newHeaderRemarkText-{{remarkId}}" type="text" class="k-input k-textbox remark-box-sm">{{remarkText}}</textarea>
		</div>
		<div class="pull-left no-print-remark">
			<input type="checkbox" id="newRemarkNoPrint-{{remarkId}}" name="newRemarkNoPrint-{{remarkId}}" class="k-widget k-checkbox" {{checkedIf noPrint}}/>
			<label for="newRemarkNoPrint-{{remarkId}}" style="padding-left: 5px">No print</label>
		</div>
		<div class="pull-right">
			<button id="newRemarkDelete-{{remarkId}}" class="k-button"><span class="glyphicon glyphicon-remove"></span></button>
			@*<button id="newRemarkUp-{{remarkId}}" class="k-button"><span class="glyphicon glyphicon-remove"></span></button>
			<button id="newRemarkDown-{{remarkId}}" class="k-button"><span class="glyphicon glyphicon-remove"></span></button>*@
		</div>
	</div>
	{{/if}}
{{/each}}
</script>

Open in new window


User generated image
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Of course you've ngKeypress directive : https://docs.angularjs.org/api/ng/directive/ngKeypress
 
Mixing AngularJS and  HandleBars seems to be a bad idea, they do the same thing...
How many page do you have ? You should rewrite them, if not yet started
Avatar of Camillia

ASKER

It's one page and this was done 7 months ago but the developer was fired and we just went to production and of course, it wasn't tested by our QA.

Can jQuery be used with it to get the entire text user has in those textarea boxes?

I'll take a look at that link.

I suggested a rewrite but manager wants it fixed.
I looked at the link and don't know how to use that or if that would even fix the issue we have..

So, page loads and you see that screenshot above. It has some text in it. User adds to that text and clicks save. At this point, the previous text...the one that was already there when the page loaded...gets saved. Ex: "test" gets saved or "testing" (the texts in those textboxes) get saved. If user types in anything new, it won't get saved.

What users have to do is to click on that "x", which deletes , then they click "add" (you don't see it in the screenshot above) and then retype and save their new text.

I thought maybe I can capture what they're typing but maybe I'm going down the wrong path. I know this page should be rewritten but my manager doesn't want to yet.

If there's no solution, then there isn't until we redesign that page.
SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, guys. This is for my previous job. I still do side work for them and the code is all jQuery, Kendo grids. The fired developer , for some reason, decided to introduce Handlebars. The other developer who works there now isn't good with JavaScript so I'm trying to help out and get this fixed.

Yes, manager doesn't care if I want to rewrite it...he wants it fixed :)

I'll take a look at your solutions tonight and post back.  With this job, I can post the entire code. They don't care. So I can post the Javascript code as well if I don't figure it out.

I'll post back.