FoxSecrets
Active member
I have a page template with a form to add/edit info and also the list of infos from the table.
Currently when I click on a item to edit, it redirects to a blank page with route admin.php?my-route/1/edit (the route is correctly set)
How can I edit the item in the same template (my-template) and populate data in the existent form?
Edit:
Template:
Currently when I click on a item to edit, it redirects to a blank page with route admin.php?my-route/1/edit (the route is correctly set)
How can I edit the item in the same template (my-template) and populate data in the existent form?
Edit:
Code:
public function actionEdit(ParameterBag $params)
{
$info = $this->assertGiftGroupsExists($params->info_id);
$viewParams = [
'info' => $info
];
return $this->view('MyApp:Class', 'my-template', $viewParams);
}
Template:
Code:
<xf:form action="{{ link('my-route/save', $info}) }}" class="block" ajax="1">
<xf:hiddenval name="info_id" id="info_id" value="{{ $info.info_id }}"></xf:hiddenval>
<xf:textboxrow name="name" value="{{ $info.name }}" label="Name" />
<xf:submitrow submit="Save" fa="fa-save" icon="" />
</xf:form>
<xf:datalist>
<xf:foreach loop="$info" key="$infoId" value="$info">
<xf:datarow rowtype="current">
<xf:cell>{$info.info_id}</xf:cell>
<xf:cell>{$info.name}</xf:cell>
<xf:cell><a href="{{ link('my-route/edit', $info) }}" data-toggle="tooltip" title="Edit">Edit</a></xf:cell>
</xf:datarow>
</xf:foreach>
</xf:datalist>
Last edited: