0

I wish to add a form to my website that will allow customers to add testimonials to the ‘testimonial’ channel as pending status. I have created the channel and custom fields i need and a new status pending. I used mijingo-expressionengine2-episode7 to guide me but since i am using EEv2.5.2 i think exp:channel:entry_form is no longer of use, so I am using exp:safecracker. Eitherway nothing happens when i submit. Filling in entry_id=”{segment_2}” throughs error - ‘You must specify a valid entry to edit.’ but in the EE documentation is says i can leave blank for data entry and this does nothing.

{exp:safecracker form_class="saef-form" channel="testimonial" status="pending" return="contact/thankyou/en/" entry_id="" use_live_url="no" url_title="" }

HTML Output hidden fields

<form id="publishForm" class="saef-form" method="post" action="http://mysite.com/site/add-testimonial"  enctype="multipart/form-data" >
<div class='hiddenFields'>
<input type="hidden" name="ACT" value="56" />
<input type="hidden" name="RET" value="http://mysite.com/site/add-testimonial" />
<input type="hidden" name="URI" value="site/add-testimonial" />
<input type="hidden" name="XID" value="d4fdd1ccc89be4d869e62c56a38f37ff277b7f6f" />
<input type="hidden" name="return_url" value="contact/thankyou/en/" />
<input type="hidden" name="author_id" value="6" />
<input type="hidden" name="channel_id" value="12" />
<input type="hidden" name="entry_id" value="0" />
<input type="hidden" name="status" value="pending" />
<input type="hidden" name="site_id" value="1" />
<input type="hidden" name="return" value="contact/thankyou/en/" />
<input type="hidden" name="allow_comments" value="n" />
</div>
<fieldset class="contactDetails">

<label for="title">Title</label>
<input id="title" name="title" type="text" size="35" value="" placeholder="Title"/>

<label for="role">Role</label>
<em>Role of the person who gave quote, eg: General Manager</em>
<input id="role" name="role" type="text" size="35" value="" placeholder="Role"/> 

<label for="affiliation">Hotel name</label>
<em> Affiliation / hotel name</em>
<input id="affiliation" name="affiliation" type="text" size="35" value="" placeholder="Hotel name"/>

<label for="testimony">Your Thoughts</label>
<em>Instructions:  The main testimony goes here.</em>
<textarea id="testimony" name="testimony" cols="40" rows="4"></textarea>

<input id="saef-submit" class="ba-button" type="submit" value="Submit" />
</fieldset>
</form>

i have removed all other scripts from the page. What am I missing?

1 Answer 1

1

Your hidden fields match my safecracker forms. So first check the following...

Step 1: Are you logged in as admin or another member group?

  • Select: Member > member groups > [for your member group ] edit group
  • Find in list: Channel Assignment Ensure this is set to yes: can post and edit entries in [channelname]

Step 2: have you allowed access to custom status?

  • Select admin > channel admin > statuses > your_status_group > pending
  • Ensure group name can access status

Step 3: remove from tag a couple of params so it looks like this

{exp:safecracker form_class="saef-form" channel="testimonial" status="pending" return="contact/thankyou/en/"}

Step 4: are you adding your own jquery?

From memory, Safecracker uses version 1.7.?. If you try and use 1.10.? it wont work. For now, ensure you arent adding your own jquery in the header. Make sure there is no other js in head (while debugging)

Step 5: simplify form further (for debugging until it works)

Take out all inputs except title ( and submit). Remove status param. Retest

Youve got me stumped. Fyi, this template on my site works.

<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
{exp:safecracker channel="store" return="browse"}
<input type="text" name="title" value="" size="50" maxlength="100"/>
<input type="submit" value="Submit" />
{/exp:safecracker}
</body>
</html>

The script in the source will look something like this...

<script type="text/javascript" charset="utf-8" src="http://mysite.com/?ACT=7&amp;ui=core,widget,mouse,position,draggable,resizable,button,dialog,datepicker&amp;plugin=scrollable,scrollable.navigator,markitup,thickbox,toolbox.expose,overlay,tmpl&amp;v=1378087729&amp;use_live_url=y&amp;include_jquery=y"></script>

I dont know what else to suggest. Im in Australia. Midnight here, so thats it for me now.

3
  • Step1: I am logged in as admin. Step2: All groups have access to status pending. Step3: I have made change to safecracker tag and still nothing happens when form submitted.
    – Matt
    Sep 20, 2013 at 13:51
  • When you say nothing happens. When you submit do you: 1) get redirected to your return page but entry is not created? Or, 2) do you press submit and submit button doesnt function? [This will be caused by jquery conflict] Or, 3) do you press submit and page reloads with fields empty but no redirect? Added 2 extra steps for you. Trust me, safecracker does work.
    – Lloyd Hill
    Sep 20, 2013 at 16:33
  • 3 press submit and page reloads with fields empty but no redirect. I noticed that page source has no jquery loaded so i added so I added safecracker_head="yes" and it had no effect. i am working from a blank template so no other scripts are loaded. also tried include_jquery="yes" aswell as removing both so default is used. Then tried setthing safecracker_head="no" and added to head <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>. No effect.
    – Matt
    Sep 23, 2013 at 12:22

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.