I have a safecracker form where I need the user to create a new entry. When the form is submitted I want the return address to include the newly created entry id, but I can't figure out how via the documentation.

I have tried:

{exp:safecracker channel="submissions" return="submission-complete/ENTRY_ID" include_jquery="no" safecracker_head="no"}


{exp:safecracker channel="submissions" return="submission-complete/{entry_id}" include_jquery="no" safecracker_head="no"}

Anyone know how to do this?

        dataType: 'json',
        beforeSend: function() {
            var percentVal = '0%';
        uploadProgress: function(event, position, total, percentComplete) {
            var percentVal = percentComplete + '%';
        success: function(data) {
            var percentVal = '100%';
window.location.href = "/submission-complete/"+data.entry_id;
  • You first approach would work as ENTRY_ID and URL_TITLE constants can be used. So Safecraker would redirect to page yoursiteurl.com/submission-complete/xxx. If not could you clarify more this question. Commented May 23, 2013 at 13:32
  • Hi @BhashkarYadav. I have suddenly realised that this might be because I am redirecting with ajax. On page load I am finding the return hidden field, taking the address and then in the 'complete' call redirecting to it.
    – ccdavies
    Commented May 23, 2013 at 13:53
  • see my edit in your code. The data should be passed within complete function like complete: function(data) . try it. it would help. Also can you see the error console in case of JavaScript error. Commented May 23, 2013 at 15:12
  • @BhashkarYadav No errors in error console, but the entry id is returning as 'undefined'.
    – ccdavies
    Commented May 23, 2013 at 15:14
  • Can you alert data like: alert (data); and share what JSON you are getting. if its alerting undefined use my updated code. Seems complete function return an object.... Commented May 23, 2013 at 15:19

2 Answers 2


As you mentioned within you comment that you are submitting the Safecraker form with AJAX. The Ajax submission returns JSON data which have entry id also. So you can redirect with JavaScript with success function like:

window.location = "/submission-complete/"+data.entry_id;

Take a reference from here: http://ellislab.com/expressionengine/user-guide/modules/safecracker/examples.html#ajax-driven-entry-form

  • Ah thanks. Not sure why, but now its not redirecting at all. Can you take a look at my code. I have added it to the question body.
    – ccdavies
    Commented May 23, 2013 at 14:55
  • Thanks for the update. Its now returning 'undefined' for the entry id though... any ideas?
    – ccdavies
    Commented May 23, 2013 at 15:12

I don't think you can since the entry ID won't be created until AFTER the form is submitted.

What you might be able to do is return to the latest entry from the logged in user, will should be the entry they just submitted via Safecracker.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.