javascriptlaravellocale

Changing input method on the fly


I have a simple form on laravel which will take name and email only and submit it to database. Name will be in Japanese. I can validate it in controller.

However, when I am using chrome; after inserting the name in Japanese; I press TAB key and input method automatically changes when cursor is on the email field. But when I am using edge the input method doesn't change automatically. I have to manually change it.

Is there any way to automatically change input method on the fly regardless of the browser? Is there any JS function and/or Laravel function that I can use?


Solution

  • I solved the problem. The trick is using css.

    In the fields I need English input, I put ime-mode inactive and type = tel. In the fields I need Japanese input, I put ime-mode active. It worked. my code was something like this.

    <input type="text" name="number" placeholder="enter your name" style="ime-mode: active;">
    <input type="tel" name="email" placeholder="enter your email" style="ime-mode: inactive;">