How to use Javascript Autocomplete with Arabic? - javascript

I have a text box on a page with auto complete/suggest functionality. The problem is that it is on Arabic and once the format of the word changes, it does not suggest correct matching phrases. For example if I type "ل" in the text box, it will suggest all the words with "ل" in its single form but it will not suggest words/phrases where "ل" is present in one of the joining forms (for example it will not suggest "لاهور").

The standard autocomplete uses substring which isn't useful for languages where a character can change when used in some context (like in Arabic).
I'm not aware of a web framework that handles this case.
You will need to write your own autocomplete code.

Related

TinyMCE Autocomplete Without Trigger Character, like gmail

I'm looking for a way to implement an autocomplete function of some sorts in TinyMCE that does not require a trigger character or shows a list of matches, but in stead suggests the continuation of a sentence like gmail does when you write an email.
(the rest of the sentence is suggested by the application)
In stead of the trigger character, the string to match will have to be for example the last few words typed, or the current sentence so far.
I have the backend to provide the actual suggestion based on a partial sentence but I can not find a way to implement this client side anywhere in the documentation. The only post on stackoverflow that looked relevant did not have the answer.
It does not work to simply not provide any trigger character, and it is also not possible to use a space bar / whitespace as the trigger character. Even if you could, it still needs to query the document for the querystring to send to my backend, not just the characters followed by a trigger character.
Should I not be using the autocomplete functionality for this? Is there a better way? How do I go about doing this?
https://fiddle.tiny.cloud/u7haab/12

Double Blind Entry (Two Pass Verification) for JavaScript?

Are there JQuery features that would help put together a double blind entry <input>?
Basically, an input that requires the exact same text to be entered twice (in the same input box). If they don't match, then the input is cleared (as if they had entered nothing).
jQuery is a framework that has the core functionalities for querying the DOM tree, making animations & etc. It hasn't any UI controls.
Meanwhile there's other library named jQueryUI. It has some popular UI controls, but there isn't such control in it, too.
I think you should write it by yourself.

jquery Highlight text or character in textbox with different color

i am trying to highlight words and characters in textbox with different colors.. same as it is when we use find function on browser to search any word and browser highlights the all word is there any jquery plugin which help me to highlights given text or character in text box
There are plenty of plugins out there. Try one of these: http://www.jquery4u.com/plugins/10-jquery-text-highlighter-plugins/
You won't be able to do that just with a textarea you'll need to use a third party solution such as:
http://www.tinymce.com/
http://ckeditor.com/
or write one yourself which is quite time consuming

Prompt with hints in Javascript

I'd like to get some input from the user:
keywords = prompt("Input keywords separated by commas", "");
I have many various strings stored in an SQLite database that could suggest the user what to type.
Let's say you have an array or list of these strings. How would you code this hinting in Javascript? Are there some functions or code snippets for this functionality?
I'd like it to work similarly as here. When you start typing you get hint with possibilities. There is only one disadvantage, that you can't input more strings separated by commas. Here is this feature working with more strings.
Is prompt() function suitable for this purpose? You can use another way of getting user input.
Thank you
You cannot tweak the native prompt() javascript method.
I know you did not tag with jQuery but would be way easier to use a library to implement such a behavior.
You'll have to build your own dialog system using maybe jQuery UI Dialogs. They have an option to make it modal so the UI is blocked until the dialog is closed.
jQuery UI Dialog will not block javascript execution though like prompt does. You might need to be able to execute code when the dialog is closed. This answer show a way to implement that easily.
Finally, the jQuery UI Autocomplete provides an example on how to use it for multiple values in the same input. They use a comma-separator but I guess you could modify the example to work with whitespaces: jQuery UIAutocomplete Multiple Values
You can't really use any custom functionality with prompt().
You'd be better off creating an <input type="text"/> and hooking the whole thing up to a button, making the data get submitted whenever a use clicks it, or presses enter. Then code it to fetch an autosugges value whenever the user types in a new character.
You should take a look at jQuery UI's autocomplete component (it works with multiple strings as an input as well). You would also need to set up a server-side script that will take a possibly incomplete string as an input and output a possible list of matches back to the browser.

Switching between input methods between HTML input fields

I have an HTML form with two input textfields.
When the user tabs from the first field to the second, I'd like to automatically switch the user's input method to a different one, say for a different language.
The reason I'm trying to do this is that I expect the user to type content in known different languages in each field.
I tried <input lang="JA" /> but that didn't seem to change the input method on Safari for Mac nor iOS.
Is it possible in HTML or JavaScript to change the input method on a per-textfield basis?
Input methods are controlled by the browser and the user. The lang attribute does not affect this, and there is no other HTML way either. It would not be useful to change the input method on a per-document, still less per-field basis, from the method normally used in the browser and accepted by the user (either silently or by finding out how to control such things).
In some situations, it can be helpful to provide special tools to users—not to override input methods but to offer additional possibilities. For example, if the expected language is written in Latin letters with a few extra letters in addition to the basic a–z, you could have buttons for entering them (to help people using keyboards that have no convenient way to type them).
It is possible to build controls that act as input method editors, see e.g. typd.in for entering Japanese. But this means using something on top of the input methods that the user is using.

Categories