I know that this is by far probably the easiest question to answer but I am having a difficulty.
I want to use tabbed panel with the first tab saying 'Overview' which display the action_view method and then I would like to display 'Update Profile' tab which will display action_edit which renders _form. I did get it to appear on different tabs in few different ways but I could not update the profile information in any way I tried. In the end, I realized that I wasn't calling the action_edit method and was just simply displaying the form instead.
Here is the code written completely in HTML, I am in process of converting this template into PHP thus my difficulty
I know that you could just call it by the href or maybe id but I could not get anything like that to work. However I have seen other use config type of settings to call on each part but I never really knew how to do that, or grasp how it was done.
When working in tabs you need to display all tabs in one call or use Ajax and a REST call to populate that tab. But the easies way is all tabs in one call.
All tabs do are hide the information <div> until someone clicks on the tab. And then hides the other tab and makes visible the one that is active,
I did have it display all tabs in one call by displaying the files but that didn't work out because I have a _form.php that both create.php and edit.php uses and I didn't quite know how to exclude the files that I didn't want.
I know that is the example that comes as default _form.php. But it means you either need to pass through vars from the action to the form or make the vars global.
Personally I don't use the create.php/update.php (or whatever it was).
I just have this little piece of code at the top of my forms.
<?php
$form_url = '/admin/documents/' . $action . '/';
if (isset($document) && $document->id != null) {
$form_url = $form_url . $document->id;
}
?>
I set a var $action in the controller to know how to built the form action.
The example comes from oil, which generates it, so there's a single view with the form for both create and edit, and code doesn't need to be replicated. It does indeed require the main view to pass data on to the _form view (I personally never use global data).
I would have that code in a Viewmodel, not in the view itself (ideally, a view should not contain logic).
And from a Fuel perspective, the logic in the "create" and "update" views should indeed be in a Viewmodel, which then uses a single form view.
For v2, we'll probably go for the same approach as for fieldsets, where you have "renderers" (which here would be "generators") that you can plugin, to allow you to generate the exact code you want.