Is quite simple but very strange.
I'm using Codeigniter, i've an App where an User can create other users and then change their passwords.
For this reason i've a simple form as the following:
<form action="<?php echo site_url("Manage/changeUserPassword"); ?>" method="post">
<input hidden class="inputwithiduser" type="text" name="iduser" value="">
<input type="password" id="inputPasswd" name="password" placeholder="New password" value="">
<button type="submit">Save</button>
</form>
I fill the first input (with class inputwithiduser) with JQuery.
Inspectioning, these inputs have the correct values. BUT.... AFTER SUBMIT my controller retrieve as $this->input->post("iduser"); the value that Chrome has saved as Username for my personal login. In other words, CHROME is changing my input (despite inspecting the iduser input with Chrome tool it's all okay) after submit!
Have you any ideas? I tried with autocomplete="off", autocomplete="false", etc without success.
Thank, Luca
Have you tried autocomplete="foo" (or whatever value)? New browsers use this attribute different as they used it before
I have the same issue, and finally i solved by this:
<input type="text" name="username" hidden/>
<input type="password" name="password" hidden/>
add two input before your oiriginal input.
Related
In my polymer 2 app I have something like this:
<form class="styling" autocomplete="on">
<div class="styling" >
<label>email</label>
<input name="email" autocomplete="email">
</div>
<div class="styling" >
<label>email</label>
<input name="password" autocomplete="current-password">
</div>
<div class="styling">
<a class="styling" on-tap="doRequestFunction">Login<a>
</div>
</form>
My issue is there are a lot of sources saying what works and what doesn't and I've tried removing the outer div, I've tried changing the email to a username, I've tried to change the <a> to an <input type="submit">. I've also tried to add an invisible username input below the email input. I have a database element that does my ajax calls so ideally I'd like to just call the request function on a form submit, but there doesn't appear to be a way to do this because it wants me to perform the action with a file or something like that.
TL;DR is there a way to do this:
<form class="styling" onSubmit="doTheRequestFunction" autocomplete="on">
<div class="styling" >
<label>email</label>
<input name="email" autocomplete="email"/>
</div>
<div class="styling" >
<label>email</label>
<input name="password" autocomplete="current-password"/>
</div>
<div class="styling">
<input class="styling" type="submit">Login</input>
</div>
</form>
There doesn't appear to be a way to do this in polymer and the ways that do don't request for the users password and are depreciated anyways. Using Chrome primarily.
EDIT: Please, no JQuery, only Javascript. I don't know what JQuery is doing half the time and it's sloppy.
autocomplete is an HTML attribute (https://www.w3schools.com/tags/att_input_autocomplete.asp). It's either on or off. It's designed to tell the browser whether it should attempt to autocomplete a field or not. The default is on so you shouldn't have to set it unless you're trying to prevent the browser from autocompleting.
Try to remove all your autocomplete attributes, and submit your form. The browser should ask you if you want to save your username and password at which point it should be populated next time you come to your form.
Also, you have an bad tag on the end of your submit button: </inoput>
<input type="submit" value="Send Request"> should be fine.
Boys, I found it.
paper-input autocomplete fails to fill
This is a polymer specific issue I was having. Currently polymer requested support for their auto-fill apparently and it's still not there. This is the solution for now. Pop that bad boy into you index.html and weep tears of joy.
Just make it
<input name="password" type="password"/>
So if input field has attribute type as password it will trigger browser to remember.
I have a login for like this:
As you see, my username and password are saved in those inputs. I want to know, is that possible to disable saving password property of the browser by JS or HTML or whatever?
Note: Using autocomplete attribute isn't useful to do that:
<form autocomplete="off" ...>
<input name="username" placeholder="Email" type="email" autocomplete="off" />
</form>
As you see, both the form and the input have autocomplete="off" attribute, but still saving password happens.
I am creating a sign up form in PHP. Every time I click on sign up button the browser asks to save the email and password. How can I stop this?
As of April 2016, this is browser-level behaviour and the user's reponsibility to control.
Two things you can do are:
You can inform the user on how to prevent this message displaying and
File a complaint with the browser devleopment team to urge them to change the behaviour. If enough people want it changed then it will be changed.
You can use autocomplete="off" on input fields like this
<input type="text" name="Username" autocomplete="off">
<input type="password" name="Password" autocomplete="off">
or on the form tag. May not work on all browsers.
Please refer to http://caniuse.com/#search=autocomplete on supported browsers.
This code solves my issue. I have just add
readonly onfocus="this.removeAttribute('readonly');"
besides
autocomplete="off"
And input should look like this
<input type="text" name="UserName" autocomplete="off" readonly
onfocus="this.removeAttribute('readonly');" >
<input type="password" name="Password" autocomplete="off" readonly
onfocus="this.removeAttribute('readonly');" >
Add attribute autocomplete="off" in form tag
-----
How do you disable the autocomplete functionality in the major browsers for a specific input (or form field)?
<input type="text" id="fullname" name="fullname" class="form-control" data-required="true" value="<?php echo $_POST['fullname']?>" >
When I open this form I see the value in this input even if I didn't insert any value.
I think adding autocomplete="off" would get you an error on most browsers, furthermore, autocomplete="off" is an invalid property.
Try to check the Mozilla Developer Documentation instead.
Just use the autocomplete attribute:
<input type="text" autocomplete="off"/>
"This would be useful when a text input is one-off and unique. Like a
CAPTCHA input, one-time use codes, or for when you have built your own
auto-suggest/auto-complete feature and need to turn off the browser
default."
Source : CSS Tricks
You could generate a random string using javasript or php and add it to the end of an input name, maybe even use a delimiter to split it apart from the actual name.
In php, you could use something like the session_id for this and simply echo it to the end of the name.
<input type="text" autocomplete="off" name="example<?php echo "," . session_id()?>">
You can replace the "," with any delimiter of your choice, so long as it isn't alphanumeric. Then when processing the data submitted, you can remove it from the end of the actual name of the input field.
With a field name always being different, your browser cant autocomplete it.
Source: https://stackoverflow.com/a/218453/12251360
Solution 1
<form name="form1" id="form1" method="post"
autocomplete="off" action="http://www.example.com/form.cgi">
This will work in Internet Explorer and Mozilla FireFox, the downside is that it is not XHTML standard.
Solution 2
The solution for Chrome is to add autocomplete="new-password" to the input type password.
Example:
<form name="myForm"" method="post">
<input name="user" type="text" />
<input name="pass" type="password" autocomplete="new-password" />
<input type="submit">
</form>
Chrome always autocomplete the data if it finds a box of type password, just enough to indicate for that box autocomplete = "new-password".
This works well for me.
Note: make sure with F12 that your changes take effect, many times browsers save the page in cache, this gave me a bad impression that it did not work, but the browser did not actually bring the changes.
Solution 3
<input type="text" id="fullname" name="fullname" autocomplete="off" class="form-control" data-required="true" value="<?php echo $_POST['fullname']?>" >
links
Solution 3 Reference : https://stackoverflow.com/a/25496311/6923146
Solution 2 Reference : https://stackoverflow.com/a/40791726/6923146
I am searching a way to make the browser ask the user if he wants to remenber his password, when a form is submited without changing the current page (using the submit event for example).
I made a jsfiddle to show this: http://jsfiddle.net/HeFFh/2.
<form action="javascript:">
<input type="text" value="user" />
<input type="password" value="pass" />
<input type="submit" />
</form>
When you press the submit button, the browser should ask you if the password have to be remembered.
It only works with Firefox. Am I doing something wrong ?
It is based on browser settings and not on the code.
For chrome: goto -> settings -> show advanced settings -> Passwords and Forum -> Select "Offer to save passwords I enter on the web"
For more help visit this link
I believe you have to have the action attribute set to something other than "javascript:" and the inputs should have a name attribute.
Try this:
<form action="/" >
<input type="text" value="user" name="username" />
<input type="password" value="pass" name="password" />
<input type="submit" />
</form>
This will not override the browser setting, but will allow the feature to be used if it's not turned off by the user