I have multiple textboxes to enter credit card and security number for it. But I dont want browsers to remember which numbers the customer entered to them.
Note: The page is completely sending ajax request by using javascript for any operations.
Refers to : Is there a W3C valid way to disable autocomplete in a HTML form?
I believe you can use the HTML attribute autocomplete with the value off.
<input ... autocomplete="off" />
Related
I am trying to submit the form but It won't. It is auto-fill the input area after submitting once. However, after auto-fill the input it does not enable the submit button.
As it works on the rest of the browsers.
I have tried to add autocomplete off attribute in form tag as well as input tag but no luck.
<form autocomplete="off" ....````
This works, but not the way that you think it does.
Officially it should be: autocomplete="off".
However many browsers bizarrely ignore this. Therefore it's best to just put some random string on the autocomplete section like:
autocomplete="autocomplete_off_randString"
Note that make sure the autocomplete value for each input is different (use JavaScript). Hence the random string at the end. Or else you may get suggestions from fields with the same autocomplete value.
in edge worked for me autocomplete="false" readonly onfocus="this.removeAttribute('readonly');" / according to this https://stackoverflow.com/a/30344707/14913109
try to use autocomplete="new-password"as describe here
In my form, the user can toggle the visibility of certain form elements using Knockout in order to save space. If the elements are visible and the user has not filled out the required fields, when they press the save button, HTML5 will notify the user of the required fields. However, when the elements are hidden, the save silently fails in that pressing the button does nothing.
The only indication to the user that something is wrong is that the save button does not respond. Of course in the console it has the familiar message 'An invalid form control is not focusable'.
Have you dealt this with issue before? How did you address it? I don't want to take away the required attribute. I suppose that one solution could be to validate with JavaScript for those types of fields instead of HTML5. Suggestions are appreciated.
Similar question:
An invalid form control with name='' is not focusable
use form submit instead of read value from selector. because HTML5 required filed will work if form get submitted.
Here's the scenario: I login to my site, at which point the browser asks me if I would like to save my details, I click yes. Later on I wish to change my password, so I go to the change password page. The browser automatically assumes the 'old password' input box is a login box and puts in the current password. This means all I have to do is type in a new password twice and the password will be changed.
It is easy to see how this is a potential security risk... I have tried a couple methods to override this which were:
Explicitly setting the input value to blank in HTML.
Setting autocomplete to off in HTML.
Using Javascript to set the value to blank (on page load, click, setTimeout).
None of my attempts thus far have worked. So my question is: Is there a cross browser solution that allows a developer to override/specifically declare where passwords should and shouldn't be filled in by the browser?
Example (of what to do):<input type="text" value="" placeholder=""></input>
Hope it helped
Just add autocomplete="off" so the browser not touch your box anymore.
<input type="text" name="xxx" autocomplete="off" />
Unfortunately it seems that, backed up by the research I have done and the response to my question, the answer is that there isn't currently a reliable, cross browser solution for this problem.
I'm working on an input form, and I have a Javascript function that gets all of the field values when you press a button. I am looking for a way to automatically refresh the Javascript values (so I can, for example, check if a username is too short on a registration page as they type, and also check if the username is available). Would this be possible?
To clarify, I have an HTML input field (for text), and as the user is typing a result, automatically update.
I'm also open to using PHP or jQuery if it's not possible using solely Javascript, but I'd prefer Javascript if it's possible. Also, sorry if this is a rather basic question, but I've searched and searched and can't find anything on it. I know it's possible because I've seen it on websites (in fact, even on this one, as you type a question, it updates the preview at the bottom).
You should use JQuery Validation Plugin to reduce the heavy checking.
Check this one out at http://jquery.bassistance.de/validate/demo/
No jQuery needed
<input type="text" onKeyUp="validate(this.value);">
function validate(value){
//validate code on value
}
You should monitor onkeyup event
<input type="text" id="test">
$('#test').on('keyup', function() { //this function is triggered every time the user releases a key while typing inside the text field above
//do whatever you want here
});
I have build a quite complex widget which contains "some kind of
form". It has a form tag, but I'm loading a lot of stuff in there via
Ajax etc. Cannot explain it in detail, and the code is too long to
paste in here.
Now, in a "live('click', function()" I use for one of the form fields,
I'm writing a couple of values into hidden fields of another form.
That works fine, as I can see them in the generated code. But if I
leave the page and then hit the back button, the values are gone.
If I write some values into those fields outside the live click
function though, they are still there when I leave the page and come
back using the back button.
But I need to write the values into the hidden fields out of the live
click function (I'm inserting values from fields of my form into
them).
I don't know what causes this and wasn't able to find a workaround yet
(even though I tried a lot).
Any ideas?
Thanks!
Have a look at the jquery history plugin (http://plugins.jquery.com/project/history)
Usually what happens is that browser remembers what you have entered into a form (even if you don't submit it) so that when you hit back button, it populates all the visible fields for you.
It seems it's not the case with hidden fields. There's a workaround though.
Every time one of your hidden fields is changed, you can add #part to your url (eg. www.mysite.com/users#userId,groupId,...).
When the page is loaded again (via back button for example), it will contain the #part. Parse it as a string to determine how to populate hidden fields and populate them.
Review the history plugin for jQuery to see how to read the #part.http://plugins.jquery.com/files/jquery.history.js_0.txt
Use CSS to hide the input instead of the input type.
<input type="text" id="foo" name="foo" style="display: none;" />
instead of
<input type="hidden" id="foo" name="foo" />
I tripped over the same issue and this seems to resolve it.