XF 2.1 form action not sending post data array

swagthris

New member
hello,

im trying to send an array (with the name report) through a post request to "testpage/update" but i never receive the post data.
Im printing $report.test in the template and its show the correct value

php code
PHP:
$report = array();
$report['test'] = 'testvalue';
$report['requestid'] = 10;
...

$viewParams = [
    'otherdata' => $otherdata,
    'report' => $report,
    'page' => $page,
    'perPage' => $perPage
];

return $this->view(getName(), 'newpage_template_view', $viewParams);

Template newpage_template_view
HTML:
<div class="block">
    <div class="block-container">
        {{$report.test}}
        <xf:form action="{{ link('testpage/update', $report) }}" ajax="true">
            <div class="block-body">
                <xf:textbox name="comment" maxlength="300" />
            </div>
            <xf:submitrow icon="save" rowtype="simple" />
        </xf:form>
    </div>
</div>


$_POST dump

Code:
Array
(
    [comment] => test text
    [_xfToken] => 1550754444,3db9a68220f5ea048c2424ec76444444
    [_xfRequestUri] => /forum/index.php?testpage/view&requestid=10
    [_xfWithData] => 1
    [_xfResponseType] => json
)
 
  1. You're dumping the data as raw text. Raw text won't be sent in a post request, only data from inputs. You'll have to put into a hiddenval-tag if you want to send it back to the server.
  2. Your data is outside of the form. Only inputs inside the form will be sent on submit.
 
  1. You're dumping the data as raw text. Raw text won't be sent in a post request, only data from inputs. You'll have to put into a hiddenval-tag if you want to send it back to the server.
  2. Your data is outside of the form. Only inputs inside the form will be sent on submit.

Where is my data outside of the form?

i have look into 'report_view' template and it does the same


HTML:
<xf:form action="{{ link('reports/update', $report) }}" ajax="true" draft="{{ link('reports/draft', $report) }}">           
    ..........
    <div class="js-handleToggle{{ !$assignedToOther ? ' is-active' : '' }}">
        <xf:submitrow icon="save" />
    </div>
</xf:form>
 
Top Bottom