Silverstripe CMS - this is a module for Silverstripe Framework rather than a standalone app. Use https://github.com/silverstripe/silverstripe-installer/ to set this up.
Thanks for reporting this. Just a note that this list isn't the right place to raise bug reports, although discussing issues using the APIs is fine. This looks like a bug though - that code snippet looks OK to me at first glance.
Can I get you to raise this as a bug on open.silverstripe.org? Ideally can you also attach your whole Page class (or whatever class this Form method is from), not just a snippet - there is already code that checks to see if the Breadcrumbs method exists & avoids calling it, so there might be something else in the class that is causing an issue.
Thanks,
Hamish Friedlander
On 19 August 2012 20:24, GerrySilva silva.gerry@gmail.com wrote:
Dear Experts
Do we have a more comprehensive tutorial on how to use the GridField in the front end?
The editable form is being displayed with the table in the same page.
Also, it works well in back end CMS but error in front ed during an "Add".
The code is unable to generate the "Cancel" button in the front end.
See code below.
Thanks for your help in advance,
Gerry
Base SS 3.0.1 version
Using GridField in front end Form Method
function Form() {
$formName = 'Form';
$config = GridFieldConfig_RecordEditor::create(25);
$config->addComponents(new GridFieldExportButton());
$itemsInGrid = MyClass::get(); // get a list of object you want to show
$gridField = new GridField("MyClass", "List of MyClass", $itemsInGrid, $config);
$fields = new FieldList($gridField);
$actions = new FieldList();
$form = new Form($this, $formName, $fields, $actions);
return $form;
}
Fatal Error message when clicking the "Add" button
9 0.4158 17641832 GridField->handleRequest( ) ..\RequestHandler.php:186
10 0.4161 17642064 GridFieldDetailForm->handleItem( ) ..\GridField.php:649
11 0.4194 17659392 RequestHandler->handleRequest( ) ..\GridFieldDetailForm.php:82
12 0.4202 17658632 GridFieldDetailForm_ItemRequest->edit( ) ..\RequestHandler.php:168
13 0.4202 17658632 GridFieldDetailForm_ItemRequest->ItemEditForm( ) ..\GridFieldDetailForm.php:254
14 0.4231 17684008 GridFieldDetailForm_ItemRequest->Breadcrumbs( ) ..\GridFieldDetailForm.php:303
GridFieldDetailForm.php
I have to temporarily comment out this section during my prototyping to make GridField work in the front end.
// Add a Cancel link which is a button-like link and link back to one level up.
$curmbs = $this->Breadcrumbs();
if($curmbs && $curmbs->count()>=2){
$one_level_up = $curmbs->offsetGet($curmbs->count()-2);
$text = "
<a class=\"crumb ss-ui-button ss-ui-action-destructive cms-panel-link ui-corner-all\" href=\"".$one_level_up->Link."\">
Cancel
</a>";
actions->push(new LiteralField('cancelbutton', $text));
}
created by: silvagerry created at: 2012-08-20 original ticket: http://open.silverstripe.org/ticket/7795
Hi,
Thanks for reporting this. Just a note that this list isn't the right place to raise bug reports, although discussing issues using the APIs is fine. This looks like a bug though - that code snippet looks OK to me at first glance.
Can I get you to raise this as a bug on open.silverstripe.org? Ideally can you also attach your whole Page class (or whatever class this Form method is from), not just a snippet - there is already code that checks to see if the Breadcrumbs method exists & avoids calling it, so there might be something else in the class that is causing an issue.
Thanks, Hamish Friedlander
On 19 August 2012 20:24, GerrySilva silva.gerry@gmail.com wrote: