SafeCracker does not update entry
Posted: 22 February 2011 08:03 PM   [ Ignore ]
Wallflower
Avatar
Rank
Total Posts:  7
Joined  2010-04-09

I’m on EE2.1.3, and is using SafeCracker 1.0.3.

Simply put, my entry form doesn’t update the entry. Neither changing the title or status does anything. Structure is handling the site structure. Might it be messing with anything?

{if logged_in}
<!-- Status overlay -->
            
{exp:safecracker channel="pages" return="{current_slug}" entry_id="5" include_jquery="no" datepicker="no"}                
                
<label for="status">Status</label>
                <
select name="status" id="status">
                    
{statuses}
                        
<option value="{status}"{selected}>{status}</option>
                    
{/statuses}
                
</select>
                <
label for="url_title">Title</label>
                    <
input type="text" name="title" id="title" value="{title}" maxlength="75" size="50" />
                <
input type="submit" name="submit" value="Submit" />
            
{/exp:safecracker}

<!-- end status overlay -->
{/if} 
 Signature 

A lover of good thinking, great music and EE.

Profile
 
 
Posted: 22 February 2011 09:02 PM   [ Ignore ]   [ # 1 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Might be Structure, might be your htaccess. Can you post your htaccess?

Profile
 
 
Posted: 22 February 2011 09:24 PM   [ Ignore ]   [ # 2 ]
Wallflower
Avatar
Rank
Total Posts:  7
Joined  2010-04-09
# Standard .htaccess file

# Secure .htaccess file
<Files .htaccess>
 
order allow,deny
 deny from all
</Files>

# Don't show any directory without an index file
Options -Indexes

# Dont list files in index pages
IndexIgnore *

# EE 404 page for missing pages
# May differ depending on where your template is located.
ErrorDocument 404 /en/index.php?/site/404

# Enable Rewrite Engine
RewriteEngine On
RewriteBase 
/

# Remove the www from the URL
# You may be able to do this through your web host or you may not need it at all.
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule 
^(.*)$ http://%1/$1 [R=301,L]

# Force the www (not used here but listed for reference)
# RewriteCond %{HTTP_HOST} !^www\.
# RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] 

# Add a trailing slash to paths without an extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule ^(.*)$ $1[L,R=301]

# Remove index.php
# Uses the "exclude method"
# http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Exclude_List_Method
# This method seems to work best for us, you might also use the include method.
# http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method
# Exclude root files
RewriteCond $!^(favicon\.ico|index\.php|path\.php|php\.ini[NC]
# Exclude EE folders
RewriteCond $!^(cp|images|themes|uploads)/ [NC]
# Exclude 3rd party folders
RewriteCond $!^(css|js|assets)/ [NC]
# Remove index.php
RewriteRule ^(.*)$ /index.php/$1 [L] 
 Signature 

A lover of good thinking, great music and EE.

Profile
 
 
Posted: 22 February 2011 09:34 PM   [ Ignore ]   [ # 3 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Fred, it’s this stuff that’s killing your form, not structure:

# Add a trailing slash to paths without an extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule ^(.*)$ $1[L,R=301] 

EE2, by default, does NOT include a trailing slash in URLs, unlike EE1. So when your form gets POSTed to the trailing-slash-less URL, it encounters a 301 redirect before the request ever gets to EE/SafeCracker, and hence nothing saves. If you absolutely MUST have trailing slashes, you can add to your htaccess rule, preventing the redirect when a POST request is met:

# Add a trailing slash to paths without an extension
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond 
%{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule ^(.*)$ $1[L,R=301] 
Profile
 
 
Posted: 22 February 2011 10:06 PM   [ Ignore ]   [ # 4 ]
Wallflower
Avatar
Rank
Total Posts:  7
Joined  2010-04-09

It’s these small things that usually gets me. Man, I just think you always is outrageously fast & helpful. Beer’s on me at EECINY!

 Signature 

A lover of good thinking, great music and EE.

Profile