populate backend create form
With the builder tool i created a standart backend form for my Customer model.
When I display the related create page (with url like .../myadmin/author/myplugin/customers/create), in some case, I need to be able to populate some text fields with predefined values (from an oldCustomer model precisely)
I tried a system D tech by forcing a value in my session or in my input but that does not work
my try with session
Session::flash('email', '[email protected]');
return Redirect::to('/myadmin/author/myplugin/customers/create');
or with input option
Input::flashOnly('email', '[email protected]');
return Redirect::to('/myadmin/author/myplugin/customers/create')->withInput();
which gives the following result in my session debugbar tab
_old_input array:2 [ "email" => null "[email protected]" => array:1 [ "com" => null ] ]
here we can see email is set but with null value then after this is whatever.
i feel i'm not so far but already spending half a day on it ! thanks for help
Answer
You can set the default values in the model constructor.
Check the session for the old value and if it exists, populate the required fields with the data.
Related Questions
- → OctoberCMS Backend Loging Hash Error
- → "failed to open stream" error when executing "migrate:make"
- → OctoberCMS - How to make collapsible list default to active only on non-mobile
- → Create plugin that makes objects from model in back-end
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → How to install console for plugin development in October CMS
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → How to update data attribute on Ajax complete
- → October CMS - Conditionally Load a Different Page