Edit box autofill does not clear placeholder - php

Basic HTML PHP CSS. I have an edit box with a placeholder. In the case that I have edited the fields once before (like username and password), and the browser has cached them, and I return to the form again (e.g., the login page), both the placeholder text and the auto filled values are appearing over top of each other. This is using the osclass code, if that matters. Clicking in the edit box removes the placeholder text, and the auto-filled value remains.
Thanks for the help!
Here's the site -
letmeborrowthat

You should turn the autocomplete off in your code
i.e.,
<input id="email" type="text" name="email" value="" class="input-text" autocomplete="off">
<input id="password" type="password" name="password" value="" class="input-text" autocomplete="off">
You can read it from the mdn here

Related

html Form preset value field

Kind of an odd question and kinda hard to explain so will try my best.
I am wondering if it is possible to take the following:
<label for="page_name">page name</label><br>
<input type="text" name="page_name" maxlength="50" size="30">
and Display none; in the CSS so that this field isn't visible to anyone filling our the form, so that its left blank. Well not blank I would like to have a preset value so that when the form is filled out, I get all their entered details and I get my preset field "page_name" that has text I have entered so that I can put for example "page 5" so that I can see which page the form has been filled out on.
Is it possible to do it in html? I have done in the past by making each page have its own form and this time around I feel like there must be an easier solution?
Thanks in advance!
Simple use type="hidden" value="your value"
<input type="text" type="hidden" value="your value" name="page_name" maxlength="50" size="30">
and submit this input field with other all fields
This is very possible, I used it to track IP adresses once.
You can simply set the value by hand:
<input type="text" name="page_name" value="Default input value" style="display:none;">
Make sure you set it to display:none; (this can be done from your stylesheet too).
Set the value="default value" wich is what otherwise would be entered by the user.
Example:
function showvalue(){
alert($('input').attr('value'));
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" name="page_name" value="Default input value" style="display:none;">
<button onclick="showvalue()">Show value </button>

HTML input only allow numbers and letters and #

I've got a question and I hope someone of you have a solution for this.
Well I have this code:
<input type="text" id="username" placeholder="Email/Username"
class="Username placeholder NoPlaceholder text"
title="Email/Username" name="usern" value=""
required="required" tabindex="1" maxlength="30"/>
I would like to limit this input field to only allow a full email address.
So to disallow other symbols like: !#$%^&*()_+{}|:">?<
Input pattern won't work as someone can just delete that by inspecting element.
If someone has a tip or idea comment below!
just use HTML5 field validator:
<form>
<input type="email" name="email" autocomplete="off">
<input type="submit" value="Submit">
</form>
This will force the user to enter a text string, which makes sense for an email address..
Success!
Don't use a text type, use HTML5's email type:
<input type="email" name="email">

placeholder change data

I have a form which gets user's telephone and stores it in an database. Then I am fetching data from the database and place it on placeholder like this.
Telephone<input name="telephone" type="text" size="25" placeholder="<?php echo $user_data_profile['telephone']; ?>"/>
everything is fine. I want to make the placeholder's data to appear as an editable text, so that the user will have the option to change his telephone number easy. Any suggestions?
I would suggest:
Telephone
<input name="telephone" type="text" size="25"
placeholder="xxx-xxx-xxxx" value="<?=$user_data_profile['telephone']?>"/>
Using whatever phone number format that is relative to your area.

Form field prefix

I Have a simple html/php form on my page and i was wondering how can i add a prefix to one of the fields?
Example: if a field acts as email field, i need to have a grey prefix like "example#example.com" and dissapear when i write the email.
Is it possible?
My Form
The field i need prefix on:
<div class="form-field">
<div class="form-field-name"><b>Facebook profile</b></div>
<input type="text" name="fields[Facebook]" class="required size_half"/>
</div>
Assuming you actually mean 'placeholder', you can use the placeholder attribute with modern browsers. For example:
<input placeholder="Facebook name" type="text" name="fields[Facebook]" class="required size_half"/>
There are plenty of jQuery plugins to fix this on older browsers, for example:
http://www.hagenburger.net/BLOG/HTML5-Input-Placeholder-Fix-With-jQuery.html

Remember password alert

This is more of an annoyance than a problem, but on all the login forms I have created over the years, none of them have ever asked the user in the browser if they want to remember password, what am I not doing?
Your form is using autocomplete="off" on the login inputs.
Remembering passwords (client side) is a function of the browser. There's nothing you need to do to trigger it. However, the autocomplete tags will turn it off. Simply remove them.
I looked and found out that it was in fact only some of my login forms that weren't doing the remember password mambo. I discovered that the difference was the id field being different to the name field on the password input is the key, i.e.
<label for="password">Password</label>
<input name="password" type="password" id="password" />
Doesn't work
But
<label for="pass">Password</label>
<input name="password" type="password" id="pass" />
Does

Categories