Author Topic: Add autocorrect="off" autocapitalize="off" to email field?  (Read 5863 times)

Offline masalachai

  • Newbie
  • *
  • Posts: 28
  • Karma: +4/-0
    • View Profile
Add autocorrect="off" autocapitalize="off" to email field?
« on: January 18, 2017, 03:42:00 PM »
To defeat iOS behavior of capitalizing the first letter in form fields, including email, need to add:
autocorrect="off" autocapitalize="off"

Anybody know where that is?

Thanks!

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2048
  • Karma: +319/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: Add autocorrect="off" autocapitalize="off" to email field?
« Reply #1 on: January 19, 2017, 06:19:52 AM »
AbanteCart builds form elements as objects and push it into template. You can edit your template and change form element there. For example change property attr

Code: [Select]
$field->attr = ' autocorrect="off" autocapitalize="off"';
or do the same via your own hook
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline masalachai

  • Newbie
  • *
  • Posts: 28
  • Karma: +4/-0
    • View Profile
Re: Add autocorrect="off" autocapitalize="off" to email field?
« Reply #2 on: January 19, 2017, 11:00:56 AM »
Thanks for the reply abolabo!
Unfortunately, I'm not sure what file you're referring to modify just the email input.  Could you please be a little more specific?

Thanks again!

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2048
  • Karma: +319/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: Add autocorrect="off" autocapitalize="off" to email field?
« Reply #3 on: January 19, 2017, 11:23:49 AM »
ok. open file public_html/storefront/view/default/template/pages/account/create.tpl and go to line #33

Code: [Select]
         <fieldset>
<?php
foreach ($form['fields']['general'] as $field_name=>$field) { ?>

<div class="form-group <?php echo ${'error_'.$field_name} ? 'has-error' ''?>">
<label class="control-label col-sm-4"><?php echo ${'entry_'.$field_name}; ?></label>
<div class="input-group col-sm-4">
    <?php echo $field?>
</div>
<span class="help-block"><?php echo ${'error_'.$field_name}; ?></span>
</div>
<?php
}
?>

</fieldset>

you should paste code
Code: [Select]
  if($field_name == 'email'){
    $field->attr = ' autocorrect="off" autocapitalize="off"';
    }

before echo $field;

and get this

Code: [Select]
<fieldset>
<?php
foreach ($form['fields']['general'] as $field_name=>$field) { ?>

<div class="form-group <?php echo ${'error_'.$field_name} ? 'has-error' ''?>">
<label class="control-label col-sm-4"><?php echo ${'entry_'.$field_name}; ?></label>
<div class="input-group col-sm-4">
    <?php
    if($field_name == 'email'){
    $field->attr ' autocorrect="off" autocapitalize="off"';
    }
    echo $field?>

</div>
<span class="help-block"><?php echo ${'error_'.$field_name}; ?></span>
</div>
<?php
}
?>

</fieldset>



“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline masalachai

  • Newbie
  • *
  • Posts: 28
  • Karma: +4/-0
    • View Profile
Re: Add autocorrect="off" autocapitalize="off" to email field?
« Reply #4 on: January 19, 2017, 11:55:55 AM »
Thanks very much for the quick reply abolabo!
Unfortunately, I must be doing something wrong because I'm just getting this in the HTML

<input type="text" name="email" id="guestFrm_email" value="" placeholder="" class="form-control "   />
<span class="input-group-addon"><span class="required">*</span></span>

Instead of
<input type="text" name="email" id="guestFrm_email" autocorrect="off" autocapitalize="off" value="" placeholder="" class="form-control "   />
<span class="input-group-addon"><span class="required">*</span></span>


Offline masalachai

  • Newbie
  • *
  • Posts: 28
  • Karma: +4/-0
    • View Profile
Re: Add autocorrect="off" autocapitalize="off" to email field?
« Reply #5 on: January 19, 2017, 12:32:11 PM »
Hi abolabo -
I must be editing the wrong page, because even hard coding the HTML into the page doesn't change a thing for the abantecart/index.php?rt=checkout/guest_step_1 page. I've cleared both the AbanteCarte cache and cPanel cache several times.
checkout/guest_step_1 is the page I'm trying to affect.

Thanks!

Offline masalachai

  • Newbie
  • *
  • Posts: 28
  • Karma: +4/-0
    • View Profile
Re: Add autocorrect="off" autocapitalize="off" to email field?
« Reply #6 on: January 19, 2017, 02:33:25 PM »
OK, got it - was the wrong page. Needed to edit guest_step_1.tpl and just hard coded the HTML like so:

<fieldset>
               <div class="form-group ">
            <label class="control-label col-md-4">First Name:</label>
            <div class="input-group col-md-6">
                <input type="text" name="firstname" id="guestFrm_firstname" value="" placeholder="" class="form-control "   />
<span class="input-group-addon"><span class="required">*</span></span>
            </div>
            <span class="help-block"></span>
         </div>      
               <div class="form-group ">
            <label class="control-label col-md-4">Last Name:</label>
            <div class="input-group col-md-6">
                <input type="text" name="lastname" id="guestFrm_lastname" value="" placeholder="" class="form-control "   />
<span class="input-group-addon"><span class="required">*</span></span>
            </div>
            <span class="help-block"></span>
         </div>      
               <div class="form-group ">
            <label class="control-label col-md-4">E-Mail:</label>
            <div class="input-group col-md-6">
                <input type="text" name="email" id="guestFrm_email" autocorrect="off" autocapitalize="off" value="" placeholder="" class="form-control "   />
<span class="input-group-addon"><span class="required">*</span></span>
            </div>
            <span class="help-block"></span>
         </div>      
            </fieldset>

 

Powered by SMFPacks Social Login Mod