# Changing names for pages from a form

**URL:** <https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426>\
**Category:** Questions\
**Tags:** v3\
**Created:** [May 29, 2019, 4:00pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426 "2019-05-29T16:00:16Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gert](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Gert](https://forum.getkirby.com/u/Gert)\
**Post date:** [May 29, 2019, 4:00pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/1 "2019-05-29T16:00:16Z")

</div>

I used

> **[Create pages from frontend](https://getkirby.com/docs/cookbook/forms/creating-pages-from-frontend)**
>
> Create pages from an event registration form

to create pages from a form, which worked fine.

However, I would like to change the following on the generated pages:

The created page folders have names like “3ae90af0d8860d97f3f9f0b578ef7198”. How can I insert the “name” from the form instead?

How can I additionally send an email to a certain address with the message that a new page has been added?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [May 29, 2019, 4:03pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/2 "2019-05-29T16:03:50Z")

</div>

This is the line that determines the folder name:

```auto
'slug' => md5(str::slug($data['name'] . microtime())),

```

change it to your liking. The encoded slug is used to make sure that folder names are unique, which they will not necessarily be if you use the name only.

To send an email on successful page creation, send the email before the `go('success')` redirect.

---

<div class="post-metadata">

**Author:** ![Gert](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Gert](https://forum.getkirby.com/u/Gert)\
**Post date:** [May 29, 2019, 5:19pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/3 "2019-05-29T17:19:59Z")

</div>

Yes, that’s right, the unique names for the folders actually make sense. I added a title field to the form, which fixed the problem.

Sending emails from the event controller doesn’t work though. I added the following code before `go('success')`:

```
$kirby->email([
  'from' => 'someone@thiscorp.com',
  'to' => 'somebody@thatfirm.com',
  'subject' => 'A new ad has been added!',
  'body'=> 'A new ad has been added!',
]);

```

Why doesn’t this work?  
Is it because the site currently runs local with mamp?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [May 29, 2019, 5:31pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/4 "2019-05-29T17:31:26Z")

</div>

Probably, if sending mail is not enabled.

---

<div class="post-metadata">

**Author:** ![Gert](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Gert](https://forum.getkirby.com/u/Gert)\
**Post date:** [May 29, 2019, 5:41pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/5 "2019-05-29T17:41:08Z")

</div>

Thank you for the support.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [May 29, 2019, 5:48pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/6 "2019-05-29T17:48:12Z")

</div>

You are welcome!

You can try using an external service or enable it locally.

---

<div class="post-metadata">

**Author:** ![Gert](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Gert](https://forum.getkirby.com/u/Gert)\
**Post date:** [June 5, 2019, 12:01pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/7 "2019-06-05T12:01:45Z")

</div>

I have now uploaded the website to a server to test the email delivery, but I get an “Error”. In MAMP it works, as I said, but there I can’t test the sending of emails. Strangely enough, the error is not displayed in the debugger, but at the point where the first word from the page’s txt file should appear, the txt file content does not load at all. The “error” is only on the page containing the form, everything else works.  
Since the website is located in a subdirectory on the server, I tried adding “RewriteBase /foldername” to the htaccess, but the error remains.

Why could it be that the ‘Creating pages from frontend’-form works with MAMP, but not on the server?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 5, 2019, 12:05pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/8 "2019-06-05T12:05:01Z")

</div>

> [@Gert](#):
>
> but at the point where the first word from the page’s txt file should appear,

?? You mean it is displayed in the page? Can you post a link?

---

<div class="post-metadata">

**Author:** ![Gert](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Gert](https://forum.getkirby.com/u/Gert)\
**Post date:** [June 5, 2019, 12:06pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/9 "2019-06-05T12:06:22Z")

</div>

Removed Link

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 5, 2019, 12:10pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/10 "2019-06-05T12:10:19Z")

</div>

That looks like your error page? If the newly created page is a draft and you are not logged in, you get the error page.

Strange this is that if I fill the form, I don’t get any feedback if the form was sent successfully?

---

<div class="post-metadata">

**Author:** ![Gert](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Gert](https://forum.getkirby.com/u/Gert)\
**Post date:** [June 5, 2019, 12:23pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/11 "2019-06-05T12:23:34Z")

</div>

I just logged in to the panel and added some text to the error page to test if it is shown (even though the page address wasn’t ‘error’ in the address bar) and now everything suddenly works, emailing and ‘success’ feedback. I probably only had to log in to the panel once, didn’t I?

If you saw the form, it must have been after I logged in, because it wasn’t displayed before.

---

<div class="post-metadata">

**Author:** ![Gert](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Gert](https://forum.getkirby.com/u/Gert)\
**Post date:** [June 5, 2019, 12:52pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/12 "2019-06-05T12:52:23Z")

</div>

No, it’s not working yet. If I call the form page with Firefox (or any other browser for the first time) instead of Chrome, I get the same error again. When I log in to the site panel in firefox, the form page is displayed afterwards.

Considering this, it’s really strange that the form was displayed in your browser.

What could be the reason for this behaviour?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 5, 2019, 1:06pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/13 "2019-06-05T13:06:36Z")

</div>

Maybe I was on the wrong page, I meant this form: [https://www.nass-reinigung.de/entwurf/de/events/](https://www.nass-reinigung.de/entwurf/de/events/)

---

<div class="post-metadata">

**Author:** ![Gert](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Gert](https://forum.getkirby.com/u/Gert)\
**Post date:** [June 5, 2019, 1:30pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/14 "2019-06-05T13:30:28Z")

</div>

Yes, thats the wrong page.

Removed Link

is the correct not working page.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 5, 2019, 1:31pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/15 "2019-06-05T13:31:21Z")

</div>

And that page is published?

---

<div class="post-metadata">

**Author:** ![Gert](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Gert](https://forum.getkirby.com/u/Gert)\
**Post date:** [June 5, 2019, 1:37pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/16 "2019-06-05T13:37:23Z")

</div>

It is now.

That seems to have been the problem. But why is the page displayed as soon as you log in to the panel?

Many thanks again.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [June 5, 2019, 1:39pm UTC](https://forum.getkirby.com/t/changing-names-for-pages-from-a-form/14426/17 "2019-06-05T13:39:25Z")

</div>

That’s what I said above, a draft is only visible to logged in users, so if you try to access it as a normal user, you are redirected to the error page.
