What you write below is a request to joomla to process that for you. There is no such field parameter called "placeholder" so obviously there is no output.
Actual core code is inside below location. This is only valid for text type field. If you need "placeholder" for other fields you would have to edit them as well similar to my example below. See Fields folder for other field types.
- Code: Select all
/libraries/joomla/form/fields/text.php
We need to add "placeholder" in to these templates so if there is request from xml file joomla will process it.
So find below line.
- Code: Select all
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
Add our code after it which is below
- Code: Select all
$placeholder = $this->element['placeholder'] ? ' placeholder="' . $this->element['placeholder'] . '"' : '';
Find following code
- Code: Select all
return '<input type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="'
. htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $class . $size . $disabled . $readonly . $onchange . $maxLength . '/>';
We now add $placeholder in to the mix so it gets processed. Replace above with below code or simply add $placeholder.
- Code: Select all
return '<input type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="'
. htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $class . $size . $disabled . $placeholder . $readonly . $onchange . $maxLength . '/>';
So now joomla will process your request. See below template when adding fields. Remove information lines so it doesn't cause errors.
- Code: Select all
<field name="myfieldname" type="text" // Fieldname must be unique name.
class="validate-username" // optional for css class if you want to use
description="COM_USERS_DESIRED_USERNAME" // You can enter a language string or simply write your own lines inside quotes.
label="COM_USERS_REGISTER_USERNAME_LABEL" // what is shown on display. Use language string or write your own lines inside quotes.
message="COM_USERS_REGISTER_USERNAME_MESSAGE"
required="true" // required or not field true / false
size="30" // size of field box
placeholder="Name"
/>
See you around...