Edit button in detail view

miki

New Member
Hi all,
is it possible to add the edit button to a details view?

Thank you in advance,
regards,

Michele
 
As an example, if your list id is 22...
Create a file named details_22.js in the ./components/com_fabrik/js folder
Paste this code in the file...
JavaScript:
requirejs(['fab/fabrik'], function () {
    var detailsUrl = window.location.href.toString();   
    var formUrl = detailsUrl.replace("details", "form");
    jQuery('div.btn-group').append('<button type="button" class="btn button" onclick="window.location=\''+formUrl+'\'" name="EditButton">Edit</button>');
});
Save
Enjoy!
 
Thanks, but I just tried this technique on two of my lists and it didn't work for either one. Any ideas why not?
 
Thanks, but I just tried this technique on two of my lists and it didn't work for either one. Any ideas why not?
That is what I use in the default protostar template. Are you using the protostar bootstrap template?
If not, examine your html in the developer console on your browser and find the div that contains your submit button.
That would be used in the last line in lieu of div.btn-group.

Or you could try hard-coding the URL. Just go to the edit page and copy the url - and use that as the value for var formUrl = "<paste the url of the edit page>".
Also, if you don't already have a Joomla menu page for editing the list in form view - you might try adding one to a hidden menu. Maybe that's why it won't work with my code.
 
This also isn't working for me...

I would be nice to have the option to turn on an EDIT button in the "buttons" tab in the Form settings for fabrik (like copy, reply, back, reset, save etc).

Until that is the case... :)

Could someone help me out with how this can be done in a custom detail template then.
Isn't there a way to add the code for a button to edit that current item?
 
Enter in your details template.
Then in file default_actions.php after
PHP:
$form = $this->form;
place this code:
PHP:
$model  = $this->getModel();
$formId = $model->getId();
$rowId  = $model->getRowId();
$view   = 'form';
$url    = JRoute::_('index.php?option=com_' . $this->package . '&view=' . $view . '&formid=' . $formId . '&rowid=' . $rowId);

And this code to display your edit button:
Code:
<button type="button" class="btn button" onclick="location.href='<?php echo $url ?>'" name="Edit">Edit</button>
 
Appreciate startpoint's suggestion as this is exactly what I needed.
However I preferred to get a button at the top (with the PDF and E-Mail Buttons).
So I edited components\com_fabrik\views\details\tmpl\bootstrap\default_buttons.php
and added:
PHP:
$model  = $this->getModel();
$formId = $model->getId();
$rowId  = $model->getRowId();
$view   = 'form';
$url    = JRoute::_('index.php?option=com_' . $this->package . '&view=' . $view . '&formid=' . $formId . '&rowid=' . $rowId);
echo '<a class="fabrik-edit btn button" href=' . $url . '" name="Edit"><i data-isicon="true" class="icon-edit "></i>Edit</a>&nbsp;';
Before or after the other default buttons.
 
Good point!
So the target is
components\com_fabrik\views\details\tmpl\mybootstrap\default_buttons.php
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top