Do you like AbanteCart? Please rate AbanteCart or share your experience with other eCommerce entrepreneurs. Go to Softaculous rating page to add your rating or write a review

Add autocorrect="off" autocapitalize="off" to email field?

Started by masalachai, January 18, 2017, 03:42:00 PM

Previous topic - Next topic

masalachai

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!

abolabo

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

$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

masalachai

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!

abolabo

ok. open file public_html/storefront/view/default/template/pages/account/create.tpl and go to line #33

         <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
  if($field_name == 'email'){
    $field->attr = ' autocorrect="off" autocapitalize="off"';
    }


before echo $field;

and get this

<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

masalachai

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>


masalachai

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!

masalachai

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>

Forum Rules Code of conduct
AbanteCart.com 2010 -