In my login form, custom layout fields are displayed by the $field->input variable. Unfortunately, those fields are displayed without the placeholder attribute.

Is there any way to add this attribute to the field which is displayed by variable above?

<?php foreach ($this->form->getFieldset($fieldset->name) as $name => $field) : ?>
    <?php if ($field->hidden === false) : ?>
        <div class="sc-group">
            <?php echo $field->input; ?>
    <?php endif; ?>
<?php endforeach; ?>

I believe that hint is the attribute you're looking for:

<field name="name"
       hint="Placeholder Text"

You need to follow below steps

  1. Go to components/com_yourcomponent/models/forms
  2. Find out the xml file which loads that form.
  3. Find the fields where you want to add the place holder text.
  4. Use hint attribute:<field name="field_name" label="Field Label" type="text" hint="Placeholder Text"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.