Skip to content

Commit

Permalink
Merge pull request #3214 from Sidsector9/issue-3202
Browse files Browse the repository at this point in the history
fix(donations): add autocomplete attributes to form fields #3202
  • Loading branch information
ravinderk committed May 14, 2018
2 parents 5c33680 + 5271604 commit 48227c1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion includes/forms/template.php
Expand Up @@ -146,7 +146,6 @@ function give_get_donation_form( $args = array() ) {
$form_html_tags = apply_filters( 'give_form_html_tags', (array) $form_html_tags, $form );
?>
<form <?php echo give_get_attribute_str( $form_html_tags ); ?> method="post">

<!-- The following field is for robots only, invisible to humans: -->
<span class="give-hidden" style="display: none !important;">
<label for="give-form-honeypot-<?php echo $form_id; ?>"></label>
Expand Down Expand Up @@ -658,6 +657,7 @@ function give_user_info_fields( $form_id ) {
class="give-input required"
type="text"
name="give_first"
autocomplete="given-name"
placeholder="<?php _e( 'First Name', 'give' ); ?>"
id="give-first"
value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>"
Expand All @@ -678,6 +678,7 @@ class="give-input required"
class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
type="text"
name="give_last"
autocomplete="family-name"
id="give-last"
placeholder="<?php _e( 'Last Name', 'give' ); ?>"
value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>"
Expand Down Expand Up @@ -730,6 +731,7 @@ class="give-input<?php echo( $give_company ? ' required' : '' ); ?>"
class="give-input required"
type="email"
name="give_email"
autocomplete="email"
placeholder="<?php _e( 'Email Address', 'give' ); ?>"
id="give-email"
value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>"
Expand Down Expand Up @@ -957,6 +959,7 @@ function give_default_cc_address_fields( $form_id ) {

<select
name="billing_country"
autocomplete="country-name"
id="billing_country"
class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
Expand All @@ -983,6 +986,7 @@ class="billing-country billing_country give-select<?php echo( give_field_is_requ
type="text"
id="card_address"
name="card_address"
autocomplete="address-line1"
class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
placeholder="<?php _e( 'Address line 1', 'give' ); ?>"
value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
Expand All @@ -1003,6 +1007,7 @@ class="card-address give-input<?php echo( give_field_is_required( 'card_address'
type="text"
id="card_address_2"
name="card_address_2"
autocomplete="address-line2"
class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
placeholder="<?php _e( 'Address line 2', 'give' ); ?>"
value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
Expand All @@ -1022,6 +1027,7 @@ class="card-address-2 give-input<?php echo( give_field_is_required( 'card_addres
type="text"
id="card_city"
name="card_city"
autocomplete="address-level3"
class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
placeholder="<?php _e( 'City', 'give' ); ?>"
value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
Expand All @@ -1045,6 +1051,7 @@ class="form-row form-row-first form-row-responsive <?php echo ( ! empty( $select
if ( ! empty( $states ) ) : ?>
<select
name="card_state"
autocomplete="address-level4"
id="card_state"
class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
Expand Down Expand Up @@ -1074,6 +1081,7 @@ class="card_state give-select<?php echo( give_field_is_required( 'card_state', $
size="4"
id="card_zip"
name="card_zip"
autocomplete="postal-code"
class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>"
value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
Expand Down

0 comments on commit 48227c1

Please sign in to comment.