1

I'm working with Stash's wrapper and partial templates. In one of my partials I've put a Safecracker-form inside a {exp:stash:set} tag. Further down that partial-template I {exp:stash:get} that form inside another "main content" {exp:stash:set}.

The form shows okay on frontend, but when I submit it I get 2 PHP-errors, and all of the form variables and values are appended to the URL.

When I put the form in the wrapper template, everything works fine.

It must be something I'm doing wrong since I'm quite new to Stash.. what can it be? The channel has no versioning btw.

The PHP-errors:

**A PHP Error was encountered**
Severity: Notice
Message: Undefined index: enable_versioning
Filename: libraries/Safecracker_lib.php
Line Number: 1378


**A PHP Error was encountered**
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /Volumes/Webdev/domains/site.nl/system/codeigniter/system/core/Exceptions.php:170)
Filename: libraries/Functions.php
Line Number: 405

Partial Template:

{embed="wrappers/_page"}

{exp:stash:set name="form"}

    {!-- this is normally on one line --}
    {exp:safecracker channel="someform" 
    return="/thanks/" 
    id="form-order" 
    error_handling="inline" 
    include_jquery="no" 
    datepicker="no" 
    safecracker_head="no"}   
        <div class="form-group">All my form fields go here</div>
        <div class="form-group">They is happy form fields</div>
    {/exp:safecracker} 
{/exp:stash:set}


{!-- the main_content var which has a "get" in the wrapper template --}
{exp:stash:set name="main_content" }
<div id="secondary" class="section-secondary section">
    <form class="form-horizontal">
        <fieldset>
            <legend>Request Form</legend>

            <div class="form-groups-container">         
                {exp:stash:get name="form"}
            </div>

        </fieldset>
    </form>
</div>
{/exp:stash:set}

-- UPDATE --
When I comment-out the versioning-stuff in Safecracker_lib.php, the form submits to a blank page, no errors whatsoever. And all the form vars en values are in the URL, ie;

http://dev.site.nl/contact/form/?ACT=6&RET=http%3A%2F%2Fdev.site.nl%2Fcontact%2Fform&URI=contact%2Fform&XID=041d37ecaac08903e79d36a4bc082d331df5d74b&return_url=%2Fcontact%2F&author_id=2&channel_id=4&entry_id=0&site_id=1&return=%2Fcontact%2F&dynamic_title=UGFra2V0IGFhbnZyYWFnIFtiZXN0ZWxmb3JtLW5hYW1d&allow_comments=y&title=&formfield1=Basis&bestelform-interesse=&formfield2=&formfield3=&formfield4=&formfield5=

--UPDATE--
Have tried several things with {stash:nocache} and all kinds of tags (process="end", parse_tags="yes" parse_depth="2") but obviously that's just random testing stuff out..

6
  • Just a tip - the second is simply triggered by the first (you almost always see that error whenever other PHP errors appear), so the Safecracker_lib.php error is the one to research. Mar 26 '13 at 9:59
  • Thank you for clearing this, will investigate that one some more.
    – Sjoerd
    Mar 26 '13 at 10:01
  • Commented out the Safecracker versioning stuff, didnt do much except now the form submits to a blank page as stated above. Weirdness.
    – Sjoerd
    Mar 26 '13 at 14:00
  • Does the safecracker form work fine for you if it's not inside Stash? Mar 26 '13 at 18:29
  • Stash can certainly change expected behaviour, especially with things like dynamic form submissions. As Adrian mentioned, I'd test without Stash to see if it works fine first. Using the 'template partials' approach with Stash (whilst very cool and very good for performance and maintenance) does go off the roster a little and is harder to get support with.
    – Ian
    Mar 26 '13 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.