Created
November 14, 2011 15:12
-
-
Save rsanchez/1364133 to your computer and use it in GitHub Desktop.
Duplicate entry with Safecracker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{!--example url: template_group/template/123--} | |
{exp:safecracker entry_id="{segment_3}" return="template_group/template/ENTRY_ID"} | |
... | |
{!-- | |
this is the trick that duplicates the entry | |
even though entry_id 123 is LOADED into this form | |
this blank entry_id field will trick SC into thinking | |
this is a new entry | |
--} | |
<input type="hidden" name="entry_id" value=""> | |
{/exp:safecracker} | |
{!-- add this code if you are using Matrix (w/ PHP on Input) --} | |
<?php $_GET['clone'] = 'y' ?> |
Well, in this case the liveUrlTitle JS would not get loaded as it only works on "new" entries. You could certainly leave the value attribute empty for title and url_title (or any other field(s) for that matter) to not inherit those fields from the parent/cloned entry.
<input type="text" name="title" value="">
OK - thanks. I tried to make a local copy of the liveUrl code, and trigger the copy, but it didn't work, and it became too complicated.
Will do without liveUrl for the time being.
rk
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be useful to have a clone-button where an existing entry serves as a template for a subsequent entry. Is it necessary to re-enter Safecracker to reset liveUrl, or could a reset be achieved programmatically by emptying title and url-title in addition to setting entry_id to empty?