1

I just want to show the status of an item on one AJAX call. I cannot find any form element that allows me to only output text. I don't want a textfield form, since that would allow the users to enter a value.

How do I show text only in a form created with the form API?

0

2 Answers 2

5

If you want to show only text, use '#markup' form element, with syntax like this:

$form['status'] = array(
  '#markup' => '<p>' . variable_get('status', t('Off')) . '</p>',
);
0
0

Why don't you use Webform ? If you want to hide something :

  • Css -> display:none
  • Js -> $('#fo').hide();
  • Hack the weform module
1
  • @ Drupal8ForTheWin Thank you for response,but I am already creating a custom module. Commented Aug 29, 2013 at 13:46

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.