Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Make a hidden field?

0 votes
asked Feb 12, 2012 in Q2A Core by osseonews
Is there a simple way to make a hidden field when adding fields to a form array in Q2A? I see there is a 'type' part of the forms array, but when I set that to 'hidden' nothing happens. The type element seems to only take a 'text' or 'static' value.
Q2A version: 1.5

1 Answer

+1 vote
answered Feb 13, 2012 by NoahY

add them to $form['hidden']:

$form['hidden']['foo'] = 'bar';

the key is the name tag, and the value is the value tag, as per qa-theme-base.php:

        function form_hidden($form)
            if (!empty($form['hidden']))
                foreach ($form['hidden'] as $name => $value)
                    $this->output('<INPUT TYPE="hidden" NAME="'.$name.'" VALUE="'.$value.'"/>');