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.

SAEF preview page and image input

August 20, 2010 10:30am

Subscribe [2]
  • #1 / Aug 20, 2010 10:30am

    phil7085

    13 posts

    Hi all,

    I’ve been creating a SAEF. I want the preview to be a separate template to the actual form. I followed the example in the docs but now want a little more control over the output so have created the form and form fields manually i.e

    <input type="input" name="field_id_1" id="field_id_1">

    etc etc..

    That’s all fine, now I have created a new template for the preview. Within that I have the tags:

    {preview}
      {MY-FIELD-1}
      {MY-FIELD-2}
      etc
    {/preview}

    Again works fine.

    The 2 problems I am running into are:

    How do I then submit the form from this preview page so then entry gets added? I have it working by creating a whole host of hidden input fields to store the entry passed across using php like this:

    <input type="hidden" id="field_id_1" name="field_id_1" value="<?php echo $field_id_1;?>" />

    Surely there is a better way?

    My second problem is that within the SAEF I have a file input for an image, again I can pass this across fine, but if I then click back from the preview to make further edits and preview or submit the form it uploads the image again, and keeps doing so for each preview. Is there a way round this?

    Perhaps I am moving back from the preview to the original SAEF wrong, I created a button named “Make more changes” which when clicked uses JavaScript to go back 1 page. Is there an EE way of doing this and retaining the form values?

    Thanks,

    Phil

    [Mod Edit: Moved to the CodeShare Corner forum]

  • #2 / Aug 20, 2010 6:43pm

    Brandon Jones

    5500 posts

    Hi Phil,

    I think hidden fields are logical for passing data between two separate pages.

    My second problem is that within the SAEF I have a file input for an image, again I can pass this across fine, but if I then click back from the preview to make further edits and preview or submit the form it uploads the image again, and keeps doing so for each preview. Is there a way round this?

    There are likely multiple approaches, but as you’re bypassing the built-in preview flow this would be one for the CodesShare Corner. If you’d like I’ll shift this over there to get you further input.

  • #3 / Aug 21, 2010 8:18am

    phil7085

    13 posts

    What is the standard built-in preview approach?

    Feel free to move the post over.

    P

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

ExpressionEngine News!

#eecms, #events, #releases