Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
597 views
in Plugins by

In a page plugin I'm using $qa_content['form'] to make a form. But how do I add a hidden field to the form? I tried this in the fields array, but it just shows a normal text input:

 

'id' => array(
  'type' => 'hidden',
  'value' => 'my value',
),
Q2A version: 1.5.2

1 Answer

+1 vote
by

I seem to be answering my own questions a lot recently ;)

Did a bit of digging and figured out that the hidden fields have their own array instead of going inside the 'fields' section. Here is the basic form layout, hope it's useful to others:

$qa_content['form']=array(
    'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"',
    'style' => 'wide',

    'fields' => array(
        // visible fields here
    ),

    'hidden' => array(
        'id' => '0',
    ),

    'buttons' => array(
        // buttons
    ),
);

 

...