Jump to content

placeholder in form


Recommended Posts

There are hundreds of forms in PS, you need to be more specific if you are looking for an answer more specific, otherwise I can tell you that in HTML you can add a placeholder like this: placeholder="my placeholder text"

Link to comment
Share on other sites

Thank you for your answer, indeed there is a lot of form and I would like to do it for all. On prestashop 1.7 the forms are different

I can not find the HTML of the various forms like that of adding address for example

    {block "form_fields"}
      {foreach from=$formFields item="field"}
        {block "form_field"}
          {form_field field=$field}
        {/block}
      {/foreach}
      {$hook_create_account_form nofilter}
    {/block}

 

Link to comment
Share on other sites

Here is example of how PrestaShop does it. 

Check in classes/form file CustomerFormatter.php

        if ($this->ask_for_birthdate) {
            $format['birthday'] = (new FormField)
                ->setName('birthday')
                ->setType('text')
                ->setLabel(
                    $this->translator->trans(
                        'Birthdate', [], 'Shop.Forms.Labels'
                    )
                )
                ->addAvailableValue('placeholder', Tools::getDateFormat())
                ->addAvailableValue(
                    'comment',
                    $this->translator->trans('(E.g.: %date_format%)', array('%date_format%' => Tools::formatDateStr('31 May 1970')), 'Shop.Forms.Help')
                )
            ;
        }

 

part 

->addAvailableValue('placeholder', Tools::getDateFormat())

 

So you probably need to make similar class with fields you need on your form.

Check other classes in that folder.

 

Let us know how it goes.

Link to comment
Share on other sites

  • 2 years later...

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...