Content Editable elements and "Share"

Hi everyone!
I’m creating a page with content editable elements and I was wondering If any could give my a hint on how to create a button that generates a link to a page with the current edited content.
Here an example of what I want to achieve http://lettersfromsweden.se check when you edit a content a bar with a button appears and you can generate a link like this. http://lettersfromsweden.se/?share=34e62

Thanks in advance

Alright, this is in the doable but hard work category!

What I can suggest:

  • Use a base page
  • Create your form on your base page
  • On user submit, create a sub-page with a unique id
  • Display the url of the newly created subpage. Optional: use the built-in url shortener.

Now you’ll find everything you need for these three steps between the documentation and here, and if you need any more guidance, please ask!
The “hard” part comes from the sub-page creation. I suggest starting by reading this post: Allow guests to create pages from Panel or frontend

Please note: You must make sure that you add validation to the user entered data to avoid any issues !!

Thanks a lot! Your explanation give me a clear path to follow.

Best regards.

Great ! Keep us posted on your progress!

If you don’t want to use forms but the html contenteditable attribute, you would have to use javascript to submit the elements on change. You could then use a route via ajax to create the subpages.

Yes this is my situation. I’m using content editable attribute. Do you have any link where I can read about submitting with JS and ajax to create the subpages?

Thanks in advance!

No, I don’t have a link that explains it all in one, but I’m sure you’ll find help if you google a bit regarding the event listener. What you basically need:

Hope this helps. If you get stuck, don’t hesitate to ask.

Thanks a lot! Thats exactly what I need. I will try to implement it as soon as possible and share my results.

Best regards

1 Like