0

I have created page with form in OctoberCMS with two functions onStart() and onSave():

title = "my page"
url = "/blog/new-post"
layout = "octaskin"
is_hidden = 0

[survey]
==
<?php
function onStart()
{
    $this['title'] = post('title');
    var_dump(post());exit; // Always empty!!!
}

function onSave()
{
    var_dump(post());exit; // With data
}

?>
==
{{
    form_open({
        files: true,
        validate: true,
        flash: true,
        request: "onSave"
    })
}}

    <input name="title" type="text" value="{{ title }}">

{{ form_close() }}

I want reinit data in field "title" in case of validation fails. But in onStart() request's data is always empty. How to access request's data from onStart()?

Nick
  • 9,735
  • 7
  • 59
  • 89
  • Have you read through this part of the documentation ? https://octobercms.com/docs/cms/pages – Oluwaseye Jul 14 '17 at 21:29
  • @Oluwaseye, yes, but it (https://octobercms.com/docs/cms/pages#handling-forms) not helps... – Nick Jul 14 '17 at 22:35
  • I think, wrap this functionality in a component it's a better way to do that, after that you can access to the request on the `onRun` or `onRender` method – OsDev Jul 17 '17 at 14:59

0 Answers0