ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

safecracker form not returning to selected page

March 14, 2012 11:43am

Subscribe [2]
  • #1 / Mar 14, 2012 11:43am

    welshartnow

    81 posts

    On submission of a safe form I would like my logged in user to be returned to the previous screen.  I picked up the ajax example in the user guide and it works fine but I cannot get the return part to function.

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Directory Entry</title>
    {exp:jquery:script_tag}
    [removed][removed]
    
    
    <link href="{path=css/_ee_saef_css}" type="text/css" rel="stylesheet" media="screen" />
    
    [removed]
                            $(document).ready(function(){
                                    $('#publishForm').ajaxForm({
                                            dataType: 'json',
                                            success: function(data) {
                                                    if (data.success) {
                                                            alert('You successfully updated your directory entry')
                                                    } else {
                                                            alert('Failed with the following errors: '+data.errors.join(', '));
                                                    }
                                            }
                                    });
                            });
     [removed]
    
    </head>
    <body>
    <div>
    <a href="/login/loginlandingpage">BACK</a>
    <h2>Edit your Directory entry here</h2>
    <p>{exp:safecracker channel="cats" return="login/loginlandingpage" entry_id="{segment_3}" json="yes" include_jquery="no"}<br />
        <label for="title">Business Name</label><br />
        <input type="text" name="title" id="title" value="{title}" size="50" maxlength="50"><br />
        <label for="web">Your Web Address must be in the form <a href="http://www.mywebsite.com&lt/label&gt">http://www.mywebsite.com</label&gt</a>;<br />
        <input type="text" name="web" id="web" value="{web}" size="50" maxlength="50"><br />
     <br />
        <input type="submit" name="submit1" value="Submit"><br />
        <br />
    {/exp:safecracker}<br />
    </div><br />
    </body><br />
    </html>

  • #2 / Mar 15, 2012 12:53pm

    Shane Eckert

    7174 posts

    Hello welshartnow,

    I am sorry to hear you are running into this problem.

    What does happen when you submit the form?

    Are you using any Add-Ons that deal with navigation, the url or redirects?

    Are you using .htaccess for anything?

    Do you have anything specific in that channel’s Channel URL preference?

    Please let me know the answers to these questions and we can go from there.

    Cheers,

  • #3 / Mar 15, 2012 2:54pm

    welshartnow

    81 posts

    Hi Shane,
    The form just remains in view.  The index.php is excluded through the htaccess file - could that be the problem?  I’m not using any plugins that interfere with the URL in any way I think.

  • #4 / Mar 16, 2012 4:50pm

    Shane Eckert

    7174 posts

    Hello welshartnow,

    Can you move the .htaccess file out of the way just for testing?

    Let me know the results. We will go from there.

    Cheers,

  • #5 / Mar 20, 2012 11:02am

    welshartnow

    81 posts

    Hi Shane,
    Itried that but without luck.

  • #6 / Mar 23, 2012 4:20pm

    Shane Eckert

    7174 posts

    Hey welshartnow,

    Okay, so that rules that out.

    Can you list for me the add-ons that you do have installed?

    What version of ExpressionEngine are you currently running?

    When you call out return=“login/loginlandingpage” is this a valid template group and template name?

    Is there a reason you are gathering the entry_id? Do you use it later?

    {exp:safecracker channel="cats" return="login/loginlandingpage" entry_id="{segment_3}"

    You typically grab that for the return page.

    return="channel_name/edit/ENTRY_ID" entry_id="{segment_3}"}

    Please let me know what you find.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases