0

I just give up. I have remembered password and login for my phpmyadmin on www.xxx.com/phpmyadmin like:

root
asdfasfsdfs

Then on my aplication on www.xxx.com/model/new , I have

<%= form_for @model do |f| %>

 <%= f.text_field :city, :placeholder => 'Write Your city' %>
 <%= f.password_field :password, :placeholder =>'SET PASSWORD' %>


<% end %>

Why browser put in text_field for city "root" and in password - password for root of phpmyadmin?

How can I remove autocomplete of this fields? I try:

 autocomplete => 'off'
 autofocus => false
 :value => ''
 $('#field').val('')

Nothings work... Peoples do not see placeholder text, because fields are filled ...

ANSWER:

Ok, I make by jQuery, like this:

$(window).load(function(){
    $('.div_class input').val('') 
});

So fields are filled but after load is done jQuery clear them.

Wordica
  • 2,427
  • 3
  • 31
  • 51

3 Answers3

5

just change the syntax a little. This worked for me :autocomplete => :off

<%= f.text_field :city, :placeholder => 'Write Your city', :autocomplete => :off %>
CodeTrooperNB
  • 51
  • 1
  • 2
0

You can turn off the feature by setting the autocomplete attribute to off in the form or field.

<%= f.text_field :city, :placeholder => 'Write Your city', :autocomplete => 'off' %>

However, keep in mind that the directive is not compatible with all browsers and major browsers are moving towards ignoring the attribute for password fields, (e.g Firefox.)

Community
  • 1
  • 1
Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
  • It doesn't work, It is very complicated issue. There are so many answers. and everyone tells the same. Please suggest if any other solution ?? – Bharat Bhushan Aug 12 '15 at 06:22
-1

NOTE: DON'T FORGET TO RESTART THE SERVER AFTER THIS CHANGE

<%= f.text_field :city, :placeholder => 'Write Your city', :autocomplete => 'off' %>
Vigneshwaran
  • 387
  • 1
  • 2
  • 14