This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Meysam
Meysam

How can I add required attribute the text field generated by Form::text?

I tried the following and it works:

<?= Form::text('title', '', ['class' => 'form-control', 'placeholder' => 'title', 'required' => '']) ?>

But required attribute should not have any value. Is there any other way to make a text field required?

Crazymodder
Crazymodder

Hi,

That looks totally ok. Does it not work like expected? If you like you can also make

'required' => 'required'
Meysam
Meysam

That works as expected. Just thought maybe there is a better way to do that.

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.