I have text fields like this that will turn red and won't let you submit the form automatically if I put the property required
on "1":
<f:form.textfield required="1"
property="name"
class="lcapp-formwidth"/>
Now I'm searching for the same in a textarea...the property required
doesn't work here anymore...what would be the "best practice" to make it a required field just like the textfield?
<f:form.textarea property="story"
rows="3"
cols="7"
class="lcapp-formwidth" />
It is true, the TextareaViewHelper does not support the required attribute as an argument, but you can add any attribute to a fluid generated tag by using the additionalAttributes
argument.
E.g.:
<f:form.textarea property="story"
rows="3"
cols="7"
class="lcapp-formwidth"
additionalAttributes="{required: 'required'}" />
Notice how additionalAttributes
expects an array notation, where the key is the name of the attribute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With