Hi,
Preview the code below. I am trying to set an attribute "placeholder" on the field, however, it isn't showing up in the template when rendered onto the screen. Any thoughts?
public function Enquire(){
//Detect action and id from url parameters for later use
$action = $this->request->param('Action');
$id = $this->request->param('ID');
//Create the form
$form = Form::create(
$this,
__FUNCTION__,
FieldList::create(
TextField::create("Name")->setTitle('Name')->setAttribute('placeholder', 'Name'),
EmailField::create("Email")->setAttribute('placeholder', 'Email*'),
PhoneNumberField::create("Phone", "Phone Number")->setAttribute('placeholder', 'Phone'),
TextAreaField::create("Comments")->setAttribute('placeholder', 'Comments'),
HiddenField::create("CarId")->setValue($id)
),
new FieldList(
new FormAction('EnquireAction', 'Send an Enquiry')
),
new RequiredFields(
'Email'
)
);
$this->extend('updateForm', $form);
return $form;
}
What is generated into the browser:
<div class="fieldholder-small">
<input type="text" name="Phone[Number]" class="numeric text nolabel" id="Phone-Number" maxlength="10" size="10">
</div>