I want to clone an existing entry. The idea is to load the entry, use JQuery to empty the title and url-title, set hidden fields such as the entry id to zero and submit the revised form as a new entry.
However, it seems Safecracker removes the keyup function on edit (segment_3 not blank). Is it possible to prevent this or work around this behaviour? Where to look?
No – I made two buttons a) To clone b) To translate spaces to underscore and ensure lower case only url-title (does not check for duplicates).
$(‘#clone’).click (function() {
var t=$(‘[name=”title”]’).val();
$(‘[name=”title”]’).val(t+”_CLONE”);
t=$(‘[name=”url_title”]’).val();
$(‘[name=”url_title”]’).val(t+”_CLONE”);
$(‘[name=”entry_id”]’).val(”);
});
$(‘#cpurl’).click (function() { var t=$(‘[name=”title”]’).val().trim().replace(/ /g,’_’).toLowerCase(); $(‘[name=”url_title”]’).val(t); });
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.