How to resolve unicode issue with javascript length? - javascript

I have angular tooltip for character counter but here i am facing some issues when user copy paste text and add some ascii characters that are not aligned with the java and orcale length when we post the data to the backend, Lets say if user have # in the text it will count lenght as 1 but backend side it will count as 4 because of the way oracle and java works with bytes.
So i am trying to resolve two issues.
1- when i paste text it character counter should count same unicode as java ?
2- It should not remove characters from the text ?
main.html
<textarea rows="2" class="form-control"
ng-model="processDTO.processStatementText"
name="processStatement" id="processStatement"
placeholder="Process Statement" maxlength="4000" required
data-tooltip-html-unsafe="<div>{{4000 - processDTO.processStatementText.length}} characters left</div>"
tooltip-trigger="{{{true: 'focus', false: 'never'}[processDTO.processStatementText.length >= 0 || processDTO.processStatementText.length == null ]}}"
tooltip-placement="top" tooltip-class="bluefill">
</textarea>
main.txt
2. Upload Template Header – Risk Causal and Impact comments are color coded as mandatory but they are optional. Similary the Originating Source System Process/Risk/control ID
3. In the upload template, for any of the multi value fields, I use an invalid delimiter ‘:’, Eg: 13:7 , for some reason this changes the cell format to time format and thereafter I am not able to give any single values, its always converted to time format. Not sure if this is a training issue, but want to put it on the table to see if it requires any fix at all
4. In Upload, for the grid field length validations, the filter doesn’t works on Row Number and Max Allowed columns. ~!##$%^&*()_+|}{:"?><,./';[]\=-0987654321`
5. ERH All levels added in the View End to End ERH screen – Sort and Filter doesn’t works, After clicking on this field, none of the other filter/sort works on the page. Also the sort indicator(black triangle) is not visible, I believe the column width needs to be adjusted.
6. The Risk/Control reference id is seen on the Process Search grids, but when I search by Risk/Control, I don’t see the corresponding control/risk grid having the ref id column however tool tip has it
7. The label change “Originating Source System Process/Risk/Control ID”"

Related

Issue using extjs to display text containing double quotes

I am using extjs to display my data from database in which records also contain some special characters. When I am displaying the records, each record has a drop down field which shows the values containing specials characters. It shows those values with hex code of those special characters like:
Value coming from server like "Rohit's, Kumar" which is correct I think but initially extjs is showing it but when I save a row and then go to update that row again, now the drop down shows some value like this:
"Rohit"s, Kumar"
Which is the wrong behavior. How do you prevent this in extjs?

Trying to calculate a percentage of possible answers that have been selected in a pdf

I have multiple forms that all follow a similar format, and that are exported from an InDesign table into Acrobat DC and then prepared as fillable forms. These track a student’s progress with a series of tasks (lines of text from the original InDesign file) and a rating of either 1, 2, or 3 (prepared as radio buttons with 3 choices) for each task.
I need to create a field to calculate the percentage of radio buttons that have been chosen (i.e., if there are 10 lines [hence 10 radio-button sets] and 4 have an entry choice selected, the field I want to create would return “40”--4 out of 10 radio-button-sets have a selection made=40%). I would LIKE to be able to calculate this percentage based on only those button choices that are a “2” or a “3” (passing grades), but I could eliminate the “1” choice and turn that into a check box, meaning that the script would only need to act on “any choice selected” instead of 2 out of the 3 choices.
Acrobat DC allows for a text box to be designated as a calculated field using JavaScript, but I have never even tried to use JS before.
Can anyone help me with a script that will divide the number of radio buttons that have a choice selected (n) by the total number of radio buttons (t), and then return that percentage (%) [n/t=%]? Since the line on which this field will be placed already has a percentage sign already in place (in the original InDesign text), it would be ideal for this percentage to be returned as a whole number (in the above example, “40” not “40%” or “.4” but I can remove that sign if I must.

OfficeJs/WordJs select text range by index and bind click event

First, Using OfficeJS/WordJS how can I select text in a paragraph by index and length. For example, my paragraph has 100 characters and I need to select all from index 2 till index 16.
Second, When I found this range - how I can add an event handler for this range? I mean, when user click at 2-16 chars in my paragraph - I will show some useful information in my Add-in.
I'm using Word 2016 Add-in.
Thanks!
I recommend you to explore the Range functionalities we added as part of the 1.3 update who is in preview right now. Please follow the instructions here on how to try the preview. please explore the added Range object functionalities (all whose Req set are 1.3 in the last column)
Please explore the "split" functionality who enables you to split a paragraph into chunks of ranges when a set of delimiters is provided. For instance you can specify a space (" ") delimiter and get all the words in that paragraph. Check this example (exercise 7 on the lab) that splits a paragraph into words.
In conjunction with the split functionality, you can use getRange and expandTo methods to expand a range. (so you get from index 'x' to 'y'
on your second question. Once you have the range, you can wrap it with a titled content control (range.insertContentControl and then specify a title for it), so that you can use the Office.context.bindings.addToNamedItemAsync API to create a Textbinding and subscribe to the BindingSelected event, as shown on this example.
Hope this guides you in the right direction.

A textfield with a restriction of columns und rows

I want to create a preview field for a text which I want to print later. The text in the preview is written by the user. The thing is that the text is not allowed to exceed over 7 rows and 33 columns (I defined those 7 rows and 33 columns in my textarea where the user inputs his text). In short: User writes text which gets submitted to the webservice -> text is saved in database -> on request the text will be shown on the html site and printable, condition: the text is not allowed to be larger than the 33 columns and 7 rows. I wanted to use a text field for this task now where I can define this special height and width, so that the text which overflows is simply not display, so that the user recognizes that there is too much text written. If there are understanding problems please tell me :)
You should use maximum number of length for text, instead of setting a certain number of columns and rows in textarea.
If you are interested in using maxlength then have a look here: How to impose maxlength on textArea in HTML using JavaScript and Limit number of lines in textarea and Display line count using jQuery.

Auto Complete Fields in Rails that Display Something Different Than What They Select

I'm trying to create an auto complete field (using the script.aculo.us plugin) in a form for a category select, but I want the auto complete list to display a number next to each category (the number of other things in the same category). This is similar to the Tags field on stack overflow.
Right now I can display the number I want, but when I select any field the extra number gets dumped into the text field with the category. Currently I'm simply appending the number to each item on the array before I display it. How can I make it so when you select something from the list the number (enclosed in parentheses) does not get put into the text field. Thank you.
I finally solved my problem, I just needed to figure out what some of the plugin's options were. It turns out there is an option for the auto_complete_field helper called :select. The value you provide to this tells the JavaScript which part of the <li> element (the HTML tags the results are displayed in) to return to the text box.
The solution was a simple matter of enclosing the name of the category in a span with a special class and leaving the number part I didn't want outside of this class. This was easy since I was already using my own partial to display the results.

Categories