Input value clears itself on focus?Which “href” value should I use for JavaScript links, “#” or “javascript:void(0)”?How do I find out which DOM element has the focus?Set a default parameter value for a JavaScript functionHow can I get query string values in JavaScript?Get selected value in dropdown list using JavaScriptSort array of objects by string property valueDisable/enable an input with jQuery?How to clear the canvas for redrawingCopy array by valueSet focus on input after render
Painting a 4x6 grid with 2 colours
How does IBM's 53-bit quantum computer compare to classical ones for cryptanalytic tasks?
Performance for simple code that converts a RGB tuple to hex string
Late 1970's and 6502 chip facilities for operating systems
Why is there not a feasible solution for a MIP?
Where are they calling from?
What do you do if you have developments on your paper during the long peer review process?
Do we know the situation in Britain before Sealion (summer 1940)?
What is the need of methods like GET and POST in the HTTP protocol?
Is it impolite to ask for halal food when traveling to and in Thailand?
Examples of "unsuccessful" theories with afterlives
Is "ln" (natural log) and "log" the same thing if used in this answer?
What causes the traces to wrinkle like this and should I be worried
Can I take NEW (still in their boxes) PC PARTS in my checked in luggage?
My Project Manager does not accept carry-over in Scrum, Is that normal?
Is it impolite to ask for an in-flight catalogue with no intention of buying?
Organisational search option
Why does this image of Jupiter look so strange?
Do we have any particular tonal center in mind when we are NOT listening music?
Why does NASA publish all the results/data it gets?
Meaning of 'ran' in German?
When is it acceptable to write a bad letter of recommendation?
Did Apollo carry and use WD40?
How to deal with my team leader who keeps calling me about project updates even though I am on leave for personal reasons?
Input value clears itself on focus?
Which “href” value should I use for JavaScript links, “#” or “javascript:void(0)”?How do I find out which DOM element has the focus?Set a default parameter value for a JavaScript functionHow can I get query string values in JavaScript?Get selected value in dropdown list using JavaScriptSort array of objects by string property valueDisable/enable an input with jQuery?How to clear the canvas for redrawingCopy array by valueSet focus on input after render
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I've found that form inputs are clearing themselves on focus when building for iOS, but I do not have this problem in the browser. Example:
let PageBody = (
<div>
<h1>Form</h1>
<br />
<form>
<p>Input: <input type="text" maxLength="100" name="someData" id="someData" /></p>
<p><input type="button" id="SaveButton" name="SaveButton" value="Save" /></p>
</form>
</div>
);
I believe this is happening at the JavaScript layer, because adding an empty onFocus="" resolves the issue, preserving the value that was in the input.
Any thoughts on where this coming from or next steps in debugging?
Edit:
I removed the onFocus="" to continue tinkering and (frustratingly) I can no longer reproduce the issue.
javascript ios reactjs cordova
add a comment
|
I've found that form inputs are clearing themselves on focus when building for iOS, but I do not have this problem in the browser. Example:
let PageBody = (
<div>
<h1>Form</h1>
<br />
<form>
<p>Input: <input type="text" maxLength="100" name="someData" id="someData" /></p>
<p><input type="button" id="SaveButton" name="SaveButton" value="Save" /></p>
</form>
</div>
);
I believe this is happening at the JavaScript layer, because adding an empty onFocus="" resolves the issue, preserving the value that was in the input.
Any thoughts on where this coming from or next steps in debugging?
Edit:
I removed the onFocus="" to continue tinkering and (frustratingly) I can no longer reproduce the issue.
javascript ios reactjs cordova
1
Please provide a more complete example, with yoursonChange
,onFocus
.etc events. Or your input is totally uncontrolled ?
– samb102
Mar 28 at 16:39
That is the strange part, I have no event listeners on that field.
– Jacob M.
Mar 28 at 16:41
1
then, what is its purpose ? what do you want to perform with ? have you read differences between controlled and uncontrolled inputs from React doc ?
– samb102
Mar 28 at 16:43
Thank you! Will dig in, I suspect that was the missing link in my understanding.
– Jacob M.
Mar 28 at 16:48
add a comment
|
I've found that form inputs are clearing themselves on focus when building for iOS, but I do not have this problem in the browser. Example:
let PageBody = (
<div>
<h1>Form</h1>
<br />
<form>
<p>Input: <input type="text" maxLength="100" name="someData" id="someData" /></p>
<p><input type="button" id="SaveButton" name="SaveButton" value="Save" /></p>
</form>
</div>
);
I believe this is happening at the JavaScript layer, because adding an empty onFocus="" resolves the issue, preserving the value that was in the input.
Any thoughts on where this coming from or next steps in debugging?
Edit:
I removed the onFocus="" to continue tinkering and (frustratingly) I can no longer reproduce the issue.
javascript ios reactjs cordova
I've found that form inputs are clearing themselves on focus when building for iOS, but I do not have this problem in the browser. Example:
let PageBody = (
<div>
<h1>Form</h1>
<br />
<form>
<p>Input: <input type="text" maxLength="100" name="someData" id="someData" /></p>
<p><input type="button" id="SaveButton" name="SaveButton" value="Save" /></p>
</form>
</div>
);
I believe this is happening at the JavaScript layer, because adding an empty onFocus="" resolves the issue, preserving the value that was in the input.
Any thoughts on where this coming from or next steps in debugging?
Edit:
I removed the onFocus="" to continue tinkering and (frustratingly) I can no longer reproduce the issue.
javascript ios reactjs cordova
javascript ios reactjs cordova
edited Mar 28 at 16:40
Jacob M.
asked Mar 28 at 16:35
Jacob M.Jacob M.
4954 silver badges14 bronze badges
4954 silver badges14 bronze badges
1
Please provide a more complete example, with yoursonChange
,onFocus
.etc events. Or your input is totally uncontrolled ?
– samb102
Mar 28 at 16:39
That is the strange part, I have no event listeners on that field.
– Jacob M.
Mar 28 at 16:41
1
then, what is its purpose ? what do you want to perform with ? have you read differences between controlled and uncontrolled inputs from React doc ?
– samb102
Mar 28 at 16:43
Thank you! Will dig in, I suspect that was the missing link in my understanding.
– Jacob M.
Mar 28 at 16:48
add a comment
|
1
Please provide a more complete example, with yoursonChange
,onFocus
.etc events. Or your input is totally uncontrolled ?
– samb102
Mar 28 at 16:39
That is the strange part, I have no event listeners on that field.
– Jacob M.
Mar 28 at 16:41
1
then, what is its purpose ? what do you want to perform with ? have you read differences between controlled and uncontrolled inputs from React doc ?
– samb102
Mar 28 at 16:43
Thank you! Will dig in, I suspect that was the missing link in my understanding.
– Jacob M.
Mar 28 at 16:48
1
1
Please provide a more complete example, with yours
onChange
, onFocus
.etc events. Or your input is totally uncontrolled ?– samb102
Mar 28 at 16:39
Please provide a more complete example, with yours
onChange
, onFocus
.etc events. Or your input is totally uncontrolled ?– samb102
Mar 28 at 16:39
That is the strange part, I have no event listeners on that field.
– Jacob M.
Mar 28 at 16:41
That is the strange part, I have no event listeners on that field.
– Jacob M.
Mar 28 at 16:41
1
1
then, what is its purpose ? what do you want to perform with ? have you read differences between controlled and uncontrolled inputs from React doc ?
– samb102
Mar 28 at 16:43
then, what is its purpose ? what do you want to perform with ? have you read differences between controlled and uncontrolled inputs from React doc ?
– samb102
Mar 28 at 16:43
Thank you! Will dig in, I suspect that was the missing link in my understanding.
– Jacob M.
Mar 28 at 16:48
Thank you! Will dig in, I suspect that was the missing link in my understanding.
– Jacob M.
Mar 28 at 16:48
add a comment
|
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55402716%2finput-value-clears-itself-on-focus%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55402716%2finput-value-clears-itself-on-focus%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Please provide a more complete example, with yours
onChange
,onFocus
.etc events. Or your input is totally uncontrolled ?– samb102
Mar 28 at 16:39
That is the strange part, I have no event listeners on that field.
– Jacob M.
Mar 28 at 16:41
1
then, what is its purpose ? what do you want to perform with ? have you read differences between controlled and uncontrolled inputs from React doc ?
– samb102
Mar 28 at 16:43
Thank you! Will dig in, I suspect that was the missing link in my understanding.
– Jacob M.
Mar 28 at 16:48