Emoji's not getting sent from text input in ionic - ionic-framework

I am trying to send emoji's from input box once I click enter it's not getting sent in form of emojis it's getting converted into "??".
<ion-input autocomplete="true" spellcheck="true" class='input-cover' type="text" [(ngModel)]="userComment" placeholder="Post a Comment">
</ion-input>

Related

Input field (type number) redirects to file upload when user pressing enter into input field

enter image description here
This is my code for input field. When I press enter into the input field it redirects to upload file from computer view.
Like that page
enter image description here
This is my code for input field under a form
<div fxFlex="20%" class="input-size" fxLayoutAlign="end center">
<mat-form-field class="w-100-p" appearance="outline">
<input type="number" min="0" matInput formControlName="AnzahlPaletten">
</mat-form-field>
</div>
I don't want to redirect to upload file view.

TinyMCE: are <input> elements wrongly handled?

I am encoutering various weird issues with <input> tags in TinyMCE (version 6, and also 5.8.2).
After entering the following in "code" view:
<input name="submit" value="myval" type="text">
I click "Save", the input field appears in the WYSIWYG view, but if I open the code view again, the name="submit" part has been removed. This does not happen with values other than "submit". Do you know why?
Also, the element selection does not work on inputs: with the following code:
<form>
<p>Firstname</p>
<input name="firstname" value="John" type="text">
</form>
Clicking on "Firstname" shows form > p in the editor footer, but clicking on the input field only shows p, like if the input element was not properly recognized.
Any clue to fix this?
Many thanks!

Trigger ion-input focus when ion-icon clicked

Good day all
I am building my first ionic 4 mobile application, and have a question about how label, icons and other elements can be connected to a form input.
In normal HTML forms you have a relationship between labels and inputs using the "for" attribute, like so:
<label for="name">Please enter name</label>
<input type="text" id="name" name="name"/>
With this relationship in place the input field gains focus when you either click on the label or on the input itself to gain focus on the input.
In ionic you use ion-label and ion-input instead of the default HTML form elements, and these seem to not share this capability.
I am specifically interested in using an icon as the aforementioned label. I tried the following without any success:
<ion-item>
<ion-label for="searchText">
<ion-icon name="search"></ion-icon> <!--name here refers to the icon displayed-->
</ion-label>
<ion-input id="searchText" name="searchText" type="text" placeholder="Search" ></ion-input>
</ion-item>
Is there something similar that one can use, or do I need to use JavaScript to achieve this?
Any advice would be greatly appropriated
So since I've been asked for a solution by someone else, let me post the workaround that I used:
I never managed to find a way to automatically add this kind of functionality like in a normal form, I did manage to trigger a click event on the icon that then caller a JavaScript function to give focus to my input field. It looks something like this:
HTML:
<ion-item color="light" class="white-iput" lines="none" (click)="focusSearch()">
<button (click)="focusSearch()" class="icon-button">
<ion-icon name="search" color="primary" for="searchText"></ion-icon>
</button>
<ion-input #input id="searchText" type="text" placeholder="Search" ></ion-input>
</ion-item>
JS (in my Type Sctipr file):
#ViewChild('input') searchInput: { setFocus: () => void; } ;
...
focusSearch() {
this.searchInput.setFocus();
}
Note that I call the "focusSearch()" function if you click anywhere in the "ion-item" wrapped around the icon and the text box, as I use CSS to have the whole thing display as a single textbox.
Hope this helps!

How to allow only alphabets in Ionic input text box?

I want to allow only alphabets and spaces to be allowed in ionic input text box.
I tried,
<ion-input type="text" pattern="[a-zA-Z ]+" ng-pattern-restrict></ion-input>
But it is not working.

Submit on enter with 2 text inputs

I have two text inputs and each has a submit button. Each button has an on click AJAX function that calls a php script and populates the page.
I need to find a way to make the enter key submit the button of the input text focused.
For example if I type something the in the "product_code" input text and press the Enter key I want to call the AJAX function of that input's assigned button (getByCode()).
Product name: <input type="text" name="product_name" id="product_name">
<input type="submit" value="Search" onClick="searchByName(document.getElementById('product_name').value)"> <br />
Product code: <input type="text" name="product_code" id="product_code">
<input type="submit" value="Search" onClick="getByCode(document.getElementById('product_code').value)"> <br />
I don't necessarily require input buttons, I could use images for example if that helps.
All browsers support document.activeElement which will tell you which element has focus. On your keypress event handler, check this value against your two inputs to see which has focus. If neither has focus, then ... ?