Hey there I’m building an interview site and to save time, I want to send the interviewees a password protected page that would allow them to fill out all the questions, upload any required images and then have that be saved as a draft page, has anyone tried this before?
If you set up a form, you can then programmatically create a page, see example:https://getkirby.com/docs/cookbook/forms/creating-pages-from-frontend
Unless you publish a page, it is always created as a draft first.
Oh thanks, this is great! Works well.
I have a couple of questions though, hope you’re able to help.
Can I decide where the new page should be created more specifically? I don’t seem to find a createParent option? I also tried the Page::create but there doesn’t seem to be a prop that lets me decide where to store the page.
$registration = $page->createChild([
'slug' => $data['name'] . microtime(),
'template' => 'product-designer',
'content' => $data
How can I upload images as part of the page creation process?
Thanks in advance.
You can set a parent using the page helper:
$registration = page('somepage')->createChild([ 'slug' => $data['name'] . microtime(), 'template' => 'product-designer', 'content' => $data ]);
Uploading files: https://getkirby.com/docs/cookbook/forms/file-uploads