EllisLab text mark
Advanced Search
     
Stand-Alone Entry Form Not Adding To Channel
Posted: 10 July 2010 02:54 AM
Joined: 2009-10-04
30 posts

I have followed the documentation for creating a stand-alone entry form to be able to add to a channel. However, when I click on submit or preview, nothing happens. It just reloads the page.

The form is working as far as pulling custom fields, so it is connected to the channel. I have been racking my brain for days on this and reading forum threads here hoping to get some answers, to no avail.

Here’s my code for the form:

{if logged_in}
{exp
:channel:entry_form channel="events" return="events/index" preview="events/add-event" hidden_pings="yes" status="Open" sticky_entry="no"}

{preview}
<h2>{title}</h2>

{display_custom_fields}

{
/preview}

<form name="addEventForm">
    <
fieldset>
    <
ul>
        <
li>
            <
label for="title">Event Title</label>
            <
input type="text" name="title" id="title" value="{title}" size="50" maxlength="100">
            <
input type="hidden" name="url_title"  id='url_title' value="{url_title}" maxlength="75" size="50" />
        </
li>

<
p>Start Date <br />
<
input type="text" name="entry_date" value="{entry_date}" maxlength="23" size="25" /></p>

<
p>Expiration Date <br />
<
input type="text" name="expiration_date" value="{expiration_date}" maxlength="23" size="25" /></p>

<
p>Comment Expiration Date <br />
<
input type="text" name="comment_expiration_date" value="{comment_expiration_date}" maxlength="23" size="25" /></p>

<
p><input type="checkbox" name="allow_comments" value="y" {allow_comments} /> Allow Comments</p>
<
p><input type='checkbox' name='dst_enabled' value='y' {dst_enabled} />DST Active on Start Date</p>

{category_menu}
<p>Categories<br />
<
select name="category[]" size="4" multiple="multiple">
{select_options}
</select>
</
p>
{/category_menu}

{custom_fields}
        
<li>
            <
p>{field_instructions}<br />
            
{formatting_buttons}</p>
            <
label for="{field_label}">{field_label}{if required}*{/if}</label>

            
{if textarea}
                
<textarea id="{field_name}" name="{field_name}" dir="{text_direction}" cols="50" rows="{rows}">{field_data}</textarea>
            
{/if}

            {if textinput}
                
<input type="text" dir="{text_direction}" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="25" />
            
{/if}

            {if pulldown}
                
<select id="{field_name}" name="{field_name}">
                    
{options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
                
</select>
            
{/if}

            {if date}
                
<input type="text" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="25" />
            
{/if}

            {if relationship}
                
<select id="{field_name}" name="{field_name}">
                    
{options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
                
</select>
            
{/if}

            {if multiselect}
                
<select id="{field_name}" name="{field_name}[]" multiple="multiple">
                    
{options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
                
</select>
            
{/if}

            {if checkbox}
                {options}{option_value} 
<input type="checkbox" id="{field_name}" name="{field_name}[]" value="{option_value}"{checked} />{/options}
            {
/if}

            {if radio}
                {options}{option_value} 
<input type="radio" id="{field_name}" name="{field_name}" value="{option_value}"{checked} />{/options}
            {
/if}

            {if file}
                
<div class="file_set js_hide">
                    <
class='filename'>
                        <
img src="{path:cp_global_img}default.png" alt="default thumbnail" />
                    </
p>
                    <
class='sub_filename'>
                        <
a href="#" class="remove_file">Remove File</a>
                    </
p>
                    <
p>
                        <
input type="hidden" name="{field_name}_hidden" value="{field_data}" />
                    </
p>
                </
div>
                <
div class="no_file js_hide">
                    <
p>
                        <
input type="file" name="{field_name}" value="{field_data}" />
                    </
p
                    <
p>
                        <
select name="{field_name_directory}">
                            
{options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
                        
</select>
                    </
p>
                </
div
                <
div class="modifiers js_show">
                    <
class='sub_filename'>
                        <
a href="#" class="choose_file">Add File</a>
                    </
p>
                </
div>
            
{/if}
        
</li>
{/custom_fields}
        
</fieldset>
        <
fieldset>
        <
li>
            <
input type="submit" name="submit" value="Submit" />
            <
input type="submit" name="preview" value="Preview" />
        </
li>
        </
fieldset>
    </
ul>
</
form>

{/exp:channel:entry_form}
{
/if}

{if logged_out}
<p>You must be logged in to submit an event.</p>
{/if} 

Any help is greatly appreciated.

[Mod Edit: Moved to the How to forum]

 
Posted: 10 July 2010 02:48 PM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2005-06-20
3997 posts

Hi Rexibit,

Which version and build of EE 2 PB are you using? Do you have an .htaccess file to remove index.php from your site URLs?

Cheers

Greg

 Signature 

   Purple Dogfish | Member of EE Pro Network | Follow me on Twitter

 
Posted: 10 July 2010 03:32 PM   [ # 2 ]   [ Rating: 0 ]
Joined: 2009-10-04
30 posts

Hello Greg,

I’m running v2.0.2pb01.

I am removing index.php via the include method and have added the template group “events” there so it will display correctly.

 
Posted: 10 July 2010 05:01 PM   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2005-06-20
3997 posts

Hi Rexibit,

Let’s just rule out any .htaccess issues with this. Please temporarily disable your .htaccess file by renaming it and then edit the General Configuration to correct the site index and then try it again.

Cheers

Greg

 Signature 

   Purple Dogfish | Member of EE Pro Network | Follow me on Twitter

 
Posted: 10 July 2010 05:13 PM   [ # 4 ]   [ Rating: 0 ]
Joined: 2009-10-04
30 posts

When I disable the .htacess file it works, so evidently it is a .htaccess issue. Do I have to include every template url title in the .htaccess and not just the template group if I am using the include method? I realize that Ellis Labs can’t support the .htacess removal of index.php, but I’m just asking your personal opinion for future reference, because the site I’m working on is going to be using a lot of these forms.

So, if the template url inside the events template group was “add-event”, I’d include “events” and “add-event”. If I had 5 other templates within that template group, I’d have to add their url titles as well, right?

 
Posted: 10 July 2010 05:38 PM   [ # 5 ]   [ Rating: 0 ]
Joined: 2009-10-04
30 posts

Scratch that, I added “add-event” in the include section of the .htaccess file and it still won’t work.

Here’s the code from my .htaccess file:

#Stop Displaying of directories
Options -Indexes

#Change the default page
DirectoryIndex index.php

#Force access to site without "www" to have "www"
#RewriteCond %{HTTP_HOST} !^www\..* [NC]
#RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteBase /

# 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]

#------------ ExpressionEngine Rewrite Rules ---------------#

# EE 404 page for missing pages
ErrorDocument 404 /index.php?/{ee:404}

# Simple 404 for missing files
<FilesMatch "(\.jpe?g|gif|png|bmp)$">
  
ErrorDocument 404 "File Not Found"
</FilesMatch>

RewriteCond $^(add\-event|contact\-us|embeds|events|links|page\-comps|rss|search|site|stylesheets|zz_search|zz_site|P[0-9]{2,8}[NC]
RewriteRule 
^(.*)$ /index.php?/$1 [L]

# Fix queries for actions, urls and css in EE
RewriteCond %{QUERY_STRING} ^(ACT=.*)$ [NC,OR]
RewriteCond 
%{QUERY_STRING} ^(URL=.*)$ [NC,OR]
RewriteCond 
%{QUERY_STRING} ^(CSS=.*)$ [NC]   
RewriteRule 
^(.*)$ /index.php\?&%{QUERY_STRING} [L]

#------------ End ExpressionEngine Rewrite Rules ---------------# 
 
Posted: 11 July 2010 02:47 PM   [ # 6 ]   [ Rating: 0 ]
Avatar
Joined: 2005-06-20
3997 posts

Hi Rexibit,

I’ve moved this thread to the How To forum. Are you using LG .htaccess generator? If so, you may wish to contact Leevi directly about your particular setup. I generally use a much simpler set of mod_rewrite rules and I find that this works well for me and the servers I use:

RewriteEngine On
RewriteCond 
%{REQUEST_FILENAME} !-d
RewriteCond 
%{REQUEST_FILENAME} !-f
RewriteRule 
^(.*)$ index.php?/$1 [L] 

Cheers

Greg

 Signature 

   Purple Dogfish | Member of EE Pro Network | Follow me on Twitter