-1

There are other questions such as this, which suggest that I can add a class as follows:

<?= $form->field($model, 'name_pu')->textInput(['maxlength' => true, 'class' => 'punjabi']) ?>

**THAT WORKS BUT **

but this replaces the form-control class given by bootstrap, which I don't want.

How can I ADD my own class, so as to get this result

<input type="text" id="regs-name_pu" class="form-control punjabi" name="Regs[name_pu]" maxlength="100">
1
  • I am looking for something dynamic,not hardcoding classes that way Commented Apr 13, 2016 at 8:05

2 Answers 2

1

You should simply add the needed class :

<?= $form->field($model, 'name_pu')->textInput(['maxlength' => true, 'class' => 'form-control punjabi']) ?>
Sign up to request clarification or add additional context in comments.

3 Comments

can we have a better solution?
because if I change my form layout and design, outside of it, I'll have to come back to this and replace the class again!
someone downvoted my question. if you think this helps future readers, kindly upvote. I don't find anything like 'no research' in this.
1

Try

<?= $form->field($model, 'name_pu')->textInput(['maxlength' => true, 'class' => 'form-control punjabi']) ?>

2 Comments

can we have a better solution
You can set $my_form_class = 'form-control punjabi', then <?= $form->field($model, 'name_pu')->textInput(['maxlength' => true, 'class' => $my_form_class]) ?>

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.