Jump to content

Add address field description


LP-Studio

Recommended Posts

Hi,

The most easy (but not the best) is editing the file:

/themes/classic/templates/_partials/form-fields.tpl

In the code:

{block name='form_field_item_other'}
  <input
    class="form-control"
    name="{$field.name}"
    type="{$field.type}"
    value="{$field.value}"
    {if isset($field.availableValues.placeholder)}placeholder="{$field.availableValues.placeholder}"{/if}
    {if $field.maxLength}maxlength="{$field.maxLength}"{/if}
    {if $field.required}required{/if}
  >
  {if isset($field.availableValues.comment)}
    <span class="form-control-comment">
      {$field.availableValues.comment}
    </span>
  {/if}
{/block}

Add a little validation like this:

{if $field.name == 'company'}
  <small>company extra info</small>
{elseif $field.name == 'vat_number'}
  <small>vat number extra info</small>
{/if}

Final code:

{block name='form_field_item_other'}
  <input
    class="form-control"
    name="{$field.name}"
    type="{$field.type}"
    value="{$field.value}"
    {if isset($field.availableValues.placeholder)}placeholder="{$field.availableValues.placeholder}"{/if}
    {if $field.maxLength}maxlength="{$field.maxLength}"{/if}
    {if $field.required}required{/if}
  >
  {if isset($field.availableValues.comment)}
    <span class="form-control-comment">
      {$field.availableValues.comment}
    </span>
  {/if}
  {if $field.name == 'company'}
    <small>company extra info</small>
  {elseif $field.name == 'vat_number'}
    <small>vat number extra info</small>
  {/if}
{/block}

And will looks like this:

image.thumb.png.b568eb9bf4069a1b6a3a0307f32fa542.png

 

Regards!

Link to comment
Share on other sites

  • 1 year later...

 

On 2/11/2019 at 12:29 PM, Rolige said:

Hi,

The most easy (but not the best) is editing the file:


/themes/classic/templates/_partials/form-fields.tpl

In the code:


{block name='form_field_item_other'}
  <input
    class="form-control"
    name="{$field.name}"
    type="{$field.type}"
    value="{$field.value}"
    {if isset($field.availableValues.placeholder)}placeholder="{$field.availableValues.placeholder}"{/if}
    {if $field.maxLength}maxlength="{$field.maxLength}"{/if}
    {if $field.required}required{/if}
  >
  {if isset($field.availableValues.comment)}
    <span class="form-control-comment">
      {$field.availableValues.comment}
    </span>
  {/if}
{/block}

Add a little validation like this:


{if $field.name == 'company'}
  <small>company extra info</small>
{elseif $field.name == 'vat_number'}
  <small>vat number extra info</small>
{/if}

Final code:


{block name='form_field_item_other'}
  <input
    class="form-control"
    name="{$field.name}"
    type="{$field.type}"
    value="{$field.value}"
    {if isset($field.availableValues.placeholder)}placeholder="{$field.availableValues.placeholder}"{/if}
    {if $field.maxLength}maxlength="{$field.maxLength}"{/if}
    {if $field.required}required{/if}
  >
  {if isset($field.availableValues.comment)}
    <span class="form-control-comment">
      {$field.availableValues.comment}
    </span>
  {/if}
  {if $field.name == 'company'}
    <small>company extra info</small>
  {elseif $field.name == 'vat_number'}
    <small>vat number extra info</small>
  {/if}
{/block}

And will looks like this:

image.thumb.png.b568eb9bf4069a1b6a3a0307f32fa542.png

 

Regards!

This really helped me too. Thanks!!

However, the code doesn't seem to work for the STATE field. 

{elseif $field.name == 'id_state'}
        <small>my text</small>

Any idea what I can do to add a comment to this field too?

 

 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...