I have a web app with a form that allows a user to enter contact information for several of their friends. When a user attempts to use the "AutoFill Contact" option that pops up when one of the form fields has focus, the info from the selected contact is used in all fields on the page instead of limiting the autofill to just the group of fields that has focus at the time.
I've looked through the documentation I could find on the autofill feature, and it looks like applying an autocomplete value of "section-*" for each field grouping should be enough. I'm guessing what I'm trying to do simply isn't possible, but input from someone well-versed in autofill settings would be much appreciated!
Here is my code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<form>
<fieldset class="container">
<div class="row">
<h2>First Friend</h2>
</div>
<div class="row">
<div>
<label for="SendRequestTo1FirstName">First Name</label>
<input type="text" id="SendRequestTo1FirstName" name="SendRequestTo1FirstName" maxlength="50" autocomplete="section-friend1" />
</div>
<div>
<label for="SendRequestTo1LastName">Last Name</label>
<input type="text" id="SendRequestTo1LastName" name="SendRequestTo1LastName" maxlength="50" autocomplete="section-friend1" />
</div>
<div>
<label for="SendRequestTo1Phone">Phone Number</label>
<input type="tel" placeholder="(111) 222-3333" id="SendRequestTo1Phone" maxlength="20" autocomplete="section-friend1" />
</div>
</div>
</fieldset>
<hr>
<fieldset class="container">
<div class="row">
<h2>Second Friend</h2>
</div>
<div class="row">
<div>
<label for="SendRequestTo2FirstName">First Name</label>
<input type="text" id="SendRequestTo2FirstName" name="SendRequestTo2FirstName" maxlength="50" autocomplete="section-friend2" />
</div>
<div>
<label for="SendRequestTo2LastName">Last Name</label>
<input type="text" id="SendRequestTo2LastName" name="SendRequestTo2LastName" maxlength="50" autocomplete="section-friend2" />
</div>
<div>
<label for="SendRequestTo2Phone">Phone Number</label>
<input type="tel" placeholder="(111) 222-3333" id="SendRequestTo2Phone" maxlength="20" autocomplete="section-friend2" />
</div>
</div>
</fieldset>
</form>
It looks like you have part of how section-* works, you just need to include a token after your section identification.
For example section-friend1 given-name:
<label for="SendRequestTo1FirstName">First Name</label>
<input type="text" id="SendRequestTo1FirstName" name="SendRequestTo1FirstName" maxlength="50" autocomplete="section-friend1 given-name" />
Here is an example from the spec, with some examples and the available tokens. https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute
Update:
Safari Caveats
Safari is really terrible with autocomplete. There isn't any documentation around what it is looking for, and doesn't seem to use any of the autocomplete standards. It seems to use a mix of id attributes and name attributes, or looks at the <label> content for the input.
Here are the best resources I found around getting both desktop and iOS Safari to work:
Blog:
https://cloudfour.com/thinks/autofill-what-web-devs-should-know-but-dont/
Codepen:
https://codepen.io/grigs/pen/YqoyWv
Credit Card autofill:
https is required in order for autocomplete to work for credit cards. Self-signed certificates do not work for Safari iOS (includes ChromeiOS), but work on desktop.
Hope this helps!
Related
do you know how is it possibile that when you enter to an input, JAWS first read content of previous field?
Is it possible to fix it or it depends on browser you use?
This is my code:
<!-- Presso -->
<div class="{!IF(presso, 'slds-show', 'slds-hide')}" style="margin-bottom: 8px">
<div class="slds-form-element slds-size--1-of-1">
<label class="slds-form-element__label">Presso</label>
<div class="slds-form-element__control">
<input id="pressoInput" class="slds-input" type="text" />
</div>
</div>
</div>
<!-- Region -->
<div class="slds-form-element">
<label class="slds-form-element__label">
Region
</label>
<div class="slds-form-element__control">
<input id="regionInput" class="slds-input" type="text" disabled="disabled"/>
</div>
</div>
I see two things. The first is your second <input> is disabled so I'm a little curious how you are getting your focus onto the second input. You're not using tab because the browser won't let you do that. Are you using the down arrow in JAWS to navigate through the DOM?
Second, you have <label> elements but you are not associating the labels with the <input> fields. Just because the <label> is next to the <input> in the DOM does not mean the screen reader will read the label when focus moves to the input. You have to tie them together. This is done with the for attribute of the <label>. The value of for should be the ID (not the NAME) property of the <input> as follows:
<label class="slds-form-element__label" for="pressoInput">Presso</label>
<div class="slds-form-element__control">
<input id="pressoInput" class="slds-input" type="text" />
</div>
...
<label class="slds-form-element__label" for="regionInput">Region</label>
<div class="slds-form-element__control">
<input id="regionInput" class="slds-input" type="text" disabled="disabled" />
</div>
I'm using Google Autocomplete address API (here the link)
I'm using angular2 and this is the code
HTML
<form autocomplete="off" method="post">
<input autocomplete="false" name="address" type="text" style="display:none;">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="shippingAddress">Address*</label>
<input id="shippingAddress" name="address" type="text" autocorrect="off" [(ngModel)]="shipping.Address1" (blur)="checkIndirizzo()" autocapitalize="off" spellcheck="off" class="form-control" #search [formControl]="searchControl">
</div>
</div>
</div>
</form>
I tryied also this
<input autocomplete="false" name="address" type="text" style="display:none;">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="shippingAddress">Address*</label>
<input id="shippingAddress" name="address" autocomplete="off" type="text" autocorrect="off" [(ngModel)]="shipping.Address1" (blur)="checkIndirizzo()" autocapitalize="off" spellcheck="off" class="form-control" #search [formControl]="searchControl">
</div>
</div>
</div>
The google autocomplete works perfectly, but the browser autofill covers the dropdown of google maps autocomplete. All I wanna do is to disable the browser autocomplete on this text input but I'm becoming crazy.
I read some solutions but no one works.
The only solution that worked is to set the input of type password and set
autocomplete="new-password"
but the problem is that I see dots when I write in the textbox and this is not good.
I tryied also with the hidden input field but nothing to do.
I'm using Chrome v 63.0.3239.84
Any help?
Chrome analyzes the text before the input and will trigger its autofill UI based on the words. I've found that putting the label after the input fixes the issue. I keep an empty label above to keep the space and then set position: absolute; on the label after
I've included a sample below
https://codepen.io/anthonyholmes/pen/YYvXEa
I have a checkbox button and a Paragraph side-by-side.
It's inline-block and everything is nice... Look:
When I turn my view into responsive, it just drops down a line. Like this:
How do I overcome this issue elegently in CSS without starting build divs around elements and bootstrap the whole deal here? Thanks!
re code; those are 2 columns and both button and paragraph reside in he left column.
EDITED FOR CODE ADDITION:
<div class="row no-pad">
<div class="col-xs-6 left-hand-input">
<!--FORM BEGIN-->
<form class="form-control-static" action="leadGen.php" method="post">
<p>PERSONAL DETAILS</p>
<hr>
<label for="firstName">FIRST NAME:</label><br>
<input name="firstName" id="firstName" type="text"><br>
<label for="email">EMAIL:</label><br>
<input name="email" id="email" type="email">
<p>SHIPMENT ADDRESS</p>
<hr>
<label for="address">ADDRESS:</label><br>
<input name="address" id="address" type="text"><br>
<label for="country">COUNTRY:</label><br>
<input name="country" id="country" type="text"><br>
<label for="zip">ZIP CODE:</label><br>
<input name="zip" id="zip" type="text"><br>
<input type="submit" id="submit" value="SEND">
<p style="display: inline-block; vertical-align: -10px;"> *Required fields</p><br>
<input checked type="checkbox" id="mailingList"/>
<p style="display: inline-block; font-size: 75%;">
Receive exclusive membership deals and offers.</p>
</form>
</div>
</div>
You need to use labels
<label><input type="checkbox" value=" id="mailingList">Receive exclusive membership deals and offers.</label>
Here is the jsfiddle demo: https://jsfiddle.net/o4qgu4gv/2/
You should also consider using col-sm-6 instead of col-xs-6 because it may look nice on an iPhone 4 screen
if it is for the checkbox or any input type tag in particular then a more suitable choice would be to use a label tag instead of a paragraph.
You could use label with its for attribute and it should work fine.
<div id="wrapper">
<input type="checkbox" id="btn"> check
<label for="btn">
this should not shift
</label>
</div>
I'm trying to remove the message box and I want to move the e-mail box to the right of the name, so that it all fits into the top bar.
I have tried removing the message box through the html code, but when I do, I get errors and it doesn't function properly.
I assume I have to remove something in the PHP because it's obviously not able to find the missing html code, but as I don't understand PHP I don't know what to remove.
this is the html code for the subscribe button
<div class="subscribe">
<div class="containerContact">
<div id="contactFormContainer">
<div id="contactForm">
<div class="loader"></div>
<div class="bar"></div>
<form action="mail.php" class="contactForm" name="cform" method="post">
<div class="input_boxes">
<p><label for="name">Name</label><span class="name-missing">Please enter your name</span><br />
<input id="name" type="text" value="" name="name" />
</p>
<p>
<label for="e-mail">E-mail</label><span class="email-missing">Please enter a valid e-mail</span><br />
<input id="e-mail" type="text" value="" name="email" />
</p>
<p><label for="message">Message</label><span class="message-missing">Say something!</span><br />
<textarea id="message" rows="" cols="" name="message"></textarea>
</p>
</div>
<input class="submit" type="submit" name="submit" value="Submit Form" onfocus="this.blur()" />
</form>
</div>
<div class="contact"></div>
</div>
</div>
<!-- this is the overlay which hides the rest of the website when the Subscribe button is pressed. -->
<div id="backgroundPopup"></div>
</div>
I can't post more than one link, so here is a text dump to the PHP and CSS for the subscribe button
any help would be much appreciated!!
Simple question, and undoubtedly an easy solution--I'm just having a lot of trouble finding it despite searching SO and Google for a while.
All I'm looking to do is take the snippet of text "I'm interested in an enhanced listing or premium profile, (a member of our team will respond promptly with further information)" and having it aligned to the right of the check box (with the text left aligned), but not wrapping around it like it is now.
Here's my JSFiddle
Code (using PureCSS for styling):
<form class="pure-form pure-form-aligned">
<fieldset>
<div class="pure-control-group">
<label for="name">Product Name</label>
<input id="name" type="text" placeholder="Username">
</div>
<div class="pure-control-group">
<label for="password">Contact Name</label>
<input id="password" type="text" placeholder="Password">
</div>
<div class="pure-control-group">
<label for="email">Contact Email</label>
<input id="email" type="email" placeholder="Email Address">
</div>
<div class="pure-control-group">
<label for="foo">Website</label>
<input id="foo" type="text" placeholder="Enter something here...">
</div>
<div class="pure-control-group">
<label for="foo">Description:</label>
<textarea id="description" type="text" placeholder="Enter description here..."></textarea>
</div>
<div class="pure-controls">
<label for="cb" class="pure-checkbox">
<input id="cb" type="checkbox">
I'm interested in an enhanced listing or premium profile, (a member of our team will respond promptly with further information)
</label>
<button type="submit" class="pure-button pure-button-primary">Submit</button>
</div>
</fieldset>
</form>
Any help would be much appreciated. Thanks.
Here's a simple way. There are probably others.
<input id="cb" type="checkbox" style="float: left; margin-top: 5px;>">
<div style="margin-left: 25px;">
I'm interested in an enhanced listing or premium profile,
(a member of our team will respond promptly with further information)
</div>
I used a div to "block" structure the text and moved it to the right. The float: left on the input keeps the checkbox to the left of the text (not above). The margin-top on the input tweaks the top alignment with the text.
The fiddle.
This is the method, that I used. It worked better for me than the many other methods I found on SO.
LABEL.indented-checkbox-text
{
margin-left: 2em;
display: block;
position: relative;
margin-top: -1.4em; /* make this margin match whatever your line-height is */
line-height: 1.4em; /* can be set here, or elsewehere */
}
<input id="myinput" type="checkbox" />
<label for="myinput" class="indented-checkbox-text">I have reviewed the business information and documentation above, and assert that the information and documentation shown is current and accurate.</label>
Try floating the check box left, and then wrap the text in a div with "overflow: hidden;". Maybe additionally, add some padding as I did below to give the text some breathing room from the check box (the padding is optional though).
<div class="pure-controls">
<label for="cb" class="pure-checkbox">
<input id="cb" type="checkbox" style="float: left;">
<div style="overflow: hidden; padding: 0px 0px 0px 5px;">
I'm interested in an enhanced listing or premium profile, (a member of our team will respond promptly with further information)
</div>
</label>
<button type="submit" class="pure-button pure-button-primary">Submit</button>
</div>