By kkinfy on
Hi,
I am generating a form using forms api. I have a text area as below
array(
'#type' => 'textarea',
'#title' => t('Street'),
'#default_value' => $obj,
'#required' => ($a4 == 2),
);
Now, kindly can anyone help me as how to add input format options to this text area.
Comments
I have the same question...
did you ever find an answer?
Thanks in advance,
Steve
Thank You Drupal Community for all the help you continue to give me, especially when I need it most!
Another person wondering the
Another person wondering the same :) Found this thread through google search... looked all through forms api, looked at several modules and have been unable to divine this elusive information
For weary travelers that may
For weary travelers that may land here through google, these items may help you along:
$form['format'] = filter_form(); - for adding the input format to your form, look it up in api or examples for exact useage
check_markup($your_field, 3, FALSE) - again, look up api or examples for exact useage, but when defining the value for your form, you need to wrap your field in check_markup to process that value with the supplied filter format
A working example
Also #type text_format can be
Also #type
text_formatcan be used. It is a text format enabled version of a textarea. See https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#text_formattext_format for Drupal 8, how to read value/format on submit
In Drupal 8, #type => 'text_format' still works. On form submit, the values can be read like this: