Viewing and then Editing

I have got asked a question: What is the best way of showing a read-only details of the model and then allowing users to edit it. I decided to create this example to show you my favourite way

I will also take advantage of the new View_ModelDetails.

I will be taking advantage of view reloading, but since the view would be substituted by form, i need to reload their parent - the page.


$model = $page->add('Model_Person')->tryLoadAny();

    $form = $page->add('Form');
        ->js('click', $page->js()->reload(array('editing'=>false)));


        ->js('click', $page->js()->reload(array('editing'=>"yes")));

Id Name Value
id Id 1
name Name 123