When doing select2 form it submits fine if I press enter but if I press tab to move to the next field and lose my input. I tried using some other select2: events to capture the input but it seems as soon as you lose focus on the field the information is gone. Any way to capture that input on the lose:focus attribute or other event?
Related
Is there a way to close the android keyboard when I'm on the last input of a form, already filled it, and click on the keyboard 'enter' button? It's a web app built with angularjs. Thanks
After the 'enter' button you could focus on an element (an <a> for example) and this should hide the soft keyboard.
Details to catch the enter button here: angularjs move focus to next control on enter
Do anyone know how to trigger this popup using JS?
I know by default it triggered by clicking submit type button when the text field is inside area.
I have my own Boostrap modal alert popup when I click submit button without filling up required text field. So once the modal alert is being dismissed, I want that default JS alert trigger after that.
What you're asking about is HTML5 Constraint Validation.
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation
For your specific example, you can use the required attribute.
We have a form which has a mandatory HTML text-area and a button which posts the form.
When user click the button with empty text-area, we show a popup that the text-area field is required and the popup has a close button on it, when a user clicks close button, we put the focus back on text-area. In this case, the keypad opens up in IPhone but the user is not able to enter anything in the field.
If the user click outside the text-area field and then again clicks on the field, then user is able to enter text in the field.
Same thing works in android device but not working for IPhone.
Can anybody give me a suggestion of what to look for or how to handle this?
We are using the focus() method to set the focus on text-area.
We have a shopping cart form which has 3 submit buttons (one to update the quantity, one to enter a promo code, and one to finish the checkout).
On desktop the user is expected to click the submit button next to the item they are affecting and this is generally what happens, the button is close to where their mouse/keyboard focus is and the visual association is strong.
On mobile it feels more natural to click the "go" or "submit" button provided by the mobile keyboard. This submits the form using the first submit button on the page rather than the most appropriate one.
Can I change what happens when a mobile user clicks the go/submit button on their keyboard?
My knowledge here is very limited, but can't you use the onsubmit callback? - http://www.htmlgoodies.com/html5/tutorials/HTML5-Development-Form--Keyboard-Events-3885651.htm#fbid=NgeGkg0S2JD
Solved this by disabling the submit buttons and conditionally enabling them based on which form field has the focus (only tested on iPhone so far).
On iPhone anyway the keyboard's go button submits using the first enabled submit button it finds. If there are no enabled buttons the button does nothing (wish it was removed if there is no enabled submit button but this is not the case).
I have a form with a textarea (it's a chat).
Pressing enter submits the form (via javascript/jquery)
It works beautifully on all regular computers with an enter key. But on iPhone, there is no enter key, and the GO (submit) button does not appear, meaning the form can't be sent
No problem if the textarea was instead input type="text" field, but then I miss the multi-line wrapping etc. from a textarea
How do I work around this? I would rather not show a submit button nor make two versions of the form.
And I believe an input field can't behave as a textarea, right? (multiline)