0

I'm trying to add a css class attribute to a field but i have a small problem :

echo $this->Form->input('dateLimite', ['type'=>'text', 'foo' => 'bar', 'class' => 'datepicker']);

Output :

<input class="form-control" type="text" name="dateLimite" foo="bar" required="required" id="datelimite">

The class attribut cannot be displayed. Have you an idea please ?

1 Answer 1

1

I'm going to go out on a limb here and guess you're using Holt59's Bootstrap 3 helpers. There's a bug in that code that overwrites the classes you set, and replaces those classes with form-control.

The guy I sit next to at work, @matt-stephens, just had a fix for that merged into the repo, so if you update it, your class should appear as expected. Testing locally:

echo $this->Form->input('dateLimite', ['type'=>'text', 'foo' => 'bar', 'class' => 'datepicker']);

Now gives:

<input type="text" name="dateLimite" class="form-control datepicker" foo="bar" class="datepicker" id="datelimite" />

Here's the merge request.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.