PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

review data before submiting

  1. I have a form that allows users to exchange a product. Before submitting I would like to give them the option to review and confirm their exchange before submitting the form. How do I do that?

    I'm guessing it's something like. create form. Form then submits to new form using "redirect" and " Pass Field Data Via Query String" This page then has a submit button.
    …but that's just a theory. I have no idea how to get that to work.

    Posted 12 years ago on Monday February 6, 2012 | Permalink
  2. For a simple form, that is probably the best way to accomplish this "out of the box". If you have a more complex form, you may want to consider a custom approach. For example, you could have the confirmation be a final page of a multi-page form. You would probably use the gform_pre_render hook to populate an HTML field on this final page with the content submitted on the previous page(s). Just another idea.

    Confirmation functionality is something we are definitely interested in adding but there is currently no ETA on when this will be added.

    Posted 12 years ago on Saturday February 11, 2012 | Permalink
  3. Hi David,

    Thanks for your solution. Its exactly what im looking for. A bit more elaboration on this would be helpful. The example in the gfrom_pre_render article uses an example of creating a form field on the go. However I am trying to populate a field that already exists, in particular a HTML content field, so what would be the format for that? Any hints or direction on this would be appreciated.

    Thanks

    Posted 12 years ago on Tuesday March 20, 2012 | Permalink
  4. Hi,

    I have made some progress in this regard. I have got basic HTML text to appear in the HTML Field. However I am struggling to place field labels and values into the form. Some direction on this would be great. My code is as follows

    http://pastebin.com/WRQY663z

    Thanks

    Posted 12 years ago on Tuesday March 20, 2012 | Permalink
  5. question

    So if the <?php
    add_filter("gform_pre_render", "pre_render_function");
    ?> is added to the function .php file then what is the next step? What is the value to add to the "insert variables " section ? or am i completely off lol? instruction please for the retard ( me ) lol

    Posted 12 years ago on Tuesday March 20, 2012 | Permalink
  6. Scott,

    Have you looked at my code? http://pastebin.com/WRQY663z

    That is the overall format. You link the filter with a function and utilize the $form object to render the form fields in a certain way, depending on what you want to do ive manage to output standard html to a particular HTML field. Now i just cant figure out how to echo form field values and labels in that field.

    Any help would be greatly appreciated.

    Thanks

    Posted 12 years ago on Wednesday March 21, 2012 | Permalink
  7. let me mess with it today the 91 what is that ? the body of the post? don't know your field ids?

    Posted 12 years ago on Wednesday March 21, 2012 | Permalink
  8. 91 is the id of the HTML Field that i want to populate
    3 is form id hence using the filter as gform_pre_render_3 rather than gform_pre_render

    say i want to echo the value or label of field id 2 into the HTML field (id 91). That is where im facing the issue. I can echo normal standard text just fine.

    Posted 12 years ago on Wednesday March 21, 2012 | Permalink
  9. Hi umarglobal,

    Looks like you're pretty close with that snippet you shared. One of the issues is your trying to save the loop syntax as part of the string:

    [php]
    $field['content'] .= foreach($form['fields'] as &$field) {;

    What you want to do is something like this:

    [php]
    $field['content'] = '<p>Please view your details and confirm your quotation by submitting the form</p>';
    $field['content'] .= '<ul>';
    
    foreach($form['fields'] as &$field) {
    
        $field['content'] .= '<li>';
    
        if($field['id']!=91) {
            $field['content'] .= $field['label'];
        }
    
        $field['content'] .= '</li>';
    
    }
    
    $field['content'] .= '</ul>';

    This just updates the syntax code so that you aren't assigning to the content string. It should now loop through all the fields and add the labels to the string. I also added in the functionality so that it will pull the value of the field from the submitted data ($_POST). That is what this bit does:

    [php]
    rgpost('input_' . $field['id'])

    Bare in mind, this only works for simple fields. When you start getting into complex fields (aka, fields with more than one input) you'll need to add logic to get all of the POST values for that field.

    Let me know how you progress from here. :)

    Posted 12 years ago on Wednesday March 21, 2012 | Permalink
  10. Hi David,

    Thanks for the prompt response. I have updated the code as suggested
    http://pastebin.com/2PB9zMNf

    Although this removes the errors i was getting before, it returns no field labels

    Posted 12 years ago on Wednesday March 21, 2012 | Permalink
  11. Ok here is what im getting out of all this for my form i am getting an error on this line endif;
    this should work? do i need to fix anything? and what do i put in the html variables? anything? or just put this in the funcions.php file and test?

    Dose this look right please look over? lol im new but code looked like admins this should be complete script if not please school me.......

    <?php add_filter('gform_pre_render_1','populate_html'); //only populating html for form id 1 - 
    
      function populate_html($form){
    
    	 foreach($form["fields"] as &$field) {
    		 if($field['id'] == 15):
    
    	  $field['content'] = '<p>Please view your details and confirm your quotation by submitting the form</p>';
       $field['content'] .= '
    <ul>';
    
      foreach($form['fields'] as &$field) {
    
        $field['content'] .= '
    <li>';
    
        if($field['id']!=15) {
            $field['content'] .= $field['label'];
        }
    
        $field['content'] .= '</li>
    ';
    
    }
    
      $field['content'] .= '</ul>
    '
    
    			       endif;
                    }
    
                    return $form;
    
            }
    
    ?>
    Posted 12 years ago on Wednesday March 21, 2012 | Permalink
  12. Hey Scott,

    Can you pastie the code? http://pastebin.com/
    Just copy the code in the field.. will make it easier to read and debug

    Scott: add a ';' after the last $field['content'] .= ''

    Posted 12 years ago on Wednesday March 21, 2012 | Permalink
  13. its there the 2nd save im testing now and the form diapiers when i past into the /themes/functions.php

    Posted 12 years ago on Wednesday March 21, 2012 | Permalink
  14. can you fix and send lol im learning

    Posted 12 years ago on Wednesday March 21, 2012 | Permalink
  15. Scott use the code im using as that works fine, as in no errors. Just change the form and field id's as your own. The only thing which is not working is that it actually does not return the form field values!!

    http://pastebin.com/2PB9zMNf

    Posted 12 years ago on Wednesday March 21, 2012 | Permalink
  16. Ideally a working example of this in the docs would be helpful.
    1) How to output a input field value to a HTML field
    2) How to output a multi value field to a HTML field

    This would so helpful

    Posted 12 years ago on Wednesday March 21, 2012 | Permalink
  17. ok just past that between <?php?> ?? form values? meaning that its not returning the post preview ?

    Posted 12 years ago on Wednesday March 21, 2012 | Permalink
  18. ya got it your right it dose not bring the form values back as requested if your still working on it please give me the solution my friends when you find it

    Posted 12 years ago on Wednesday March 21, 2012 | Permalink
  19. any luck? still no good for me i just cant get it to populate the html id 15 with the post values.

    Posted 12 years ago on Wednesday March 21, 2012 | Permalink
  20. any head way?

    Posted 12 years ago on Thursday March 22, 2012 | Permalink
  21. nah no dice,

    Im looking to hire someone to get this solution done. The only way forward :)

    Posted 12 years ago on Thursday March 22, 2012 | Permalink
  22. Hi, guys,

    I have added a new example to the documentation for the gform_pre_render hook (http://www.gravityhelp.com/documentation/page/Gform_pre_render) . The example displays data from page 1 of a form on page 2 as a preview. The example handles simple fields and some of the complex ones like name and address. Take a look at the new example and let me know if you have questions.

    Posted 12 years ago on Friday March 23, 2012 | Permalink
  23. GZA
    Member

    Thank you for the examples but it's amazing that GF doesn't have this functionality out of box.

    Posted 12 years ago on Friday March 23, 2012 | Permalink
  24. It's actually amazing what Gravity Forms DOES do out of the box. This is just something else that will eventually get added to the feature list.. there are lots of more highly requested features that are ahead of this on the development list.

    Posted 12 years ago on Friday March 23, 2012 | Permalink
  25. ah Got it!!!!!!!!!! thank you GF Support they are the best!!!!!!!!! so its all good firing on all 8 bringing back all form fields but the photos anyone have any other suggestions on the photos??

    Posted 12 years ago on Saturday March 24, 2012 | Permalink
  26. Hi Dana,

    This is what i call brilliant support thank you for your example. Although you use complex fields such as name, address which is great, i think us users will definitly benefit from getting a value from a drop down field or radio button field. A field which has muliple values etc. Dont have to come up with an example just a method on how to figure out which value is active on a drop down menu and pull that into the HTML field

    Regards

    Posted 12 years ago on Saturday March 24, 2012 | Permalink
  27. Hi

    Yes so all figured out! The photo fileld are not included in the preview any idas or example's?

    Posted 12 years ago on Monday March 26, 2012 | Permalink
  28. Hi, guys,

    umarglobal: The data displayed is pulled from the posted form data, so this works for drop downs and radio buttons. The code is separated into the complex and simple fields. By complex I mean the fields that when you add them to your form are actually groups, like the address or name fields. The simple fields are non-grouped, just a single field.

    scott: I have updated the example to display the name of the file uploaded or post image uploaded. If these are images, you can add html to present it as an <img> tag to the appropriate url. You had also asked about adding text before the form data is displayed, you can do this by adding text to the $html_content variable (see the example).

    This should be enough to get you guys pointed in the right direction. Have fun!

    Posted 12 years ago on Monday March 26, 2012 | Permalink
  29. Dana,

    Your a star * .. thanks for this.

    Posted 12 years ago on Monday March 26, 2012 | Permalink
  30. Hmm got the html text part ok but "you can add html to present it as an <img> tag to the appropriate url." not shore on this can you elaborate ? The poster is uploading images or leaving the fields blank.

    Posted 12 years ago on Tuesday March 27, 2012 | Permalink
  31. we did test and could not get the images to show in the preview with the new example by the way.

    Posted 12 years ago on Tuesday March 27, 2012 | Permalink
  32. We do see the image name but would like to see the image or both but need the image definitely..

    Posted 12 years ago on Tuesday March 27, 2012 | Permalink
  33. scott, you may have to try to source out the url for the location of the image. Dont know where that is saved tho, may have to dig into the plugins core files to have a look as I have been unable to locate that in the docs.

    On a further note one thing that is very important in the review section, is to not show entries that are hidden as a result of failing the conditional logic of prior fields. I have managed to not include fields that are empty but there has be a if rule which checks if a field meets its conditional logic rule and if not then it should not appear in the review section at the end.

    Any help on this?

    Posted 12 years ago on Thursday March 29, 2012 | Permalink
  34. Hmmm ya i did look thru the plugins files but im not shore thats the answer, It seams to me if the hook can call the name of the field it should be able to call the image its self, dont you think? The answer was given "you can add html to present it as an <img> tag to the appropriate url. " but i needed more info on this was thinking maybe just a script alteration? is this what that is? need example because im not shore of how to do what she was explaining.. Any help will work....

    Posted 12 years ago on Thursday March 29, 2012 | Permalink
  35. Any Luck? With bringing back the photos not the photos file name in the preview?

    Posted 12 years ago on Friday March 30, 2012 | Permalink
  36. Has anyone figured it out yet? all weekend 0 headway i.e looking for the photos in the preview not the file name.

    Posted 12 years ago on Monday April 2, 2012 | Permalink
  37. I have updated the example in the documentation to include creating an <img> tag for the uploaded files in the html content. Files are uploaded to a temporary directory and the image tag source needs to point to this location.

    Posted 12 years ago on Wednesday April 4, 2012 | Permalink
  38. Perfect I could not get this to work "as is" so i wrapped the

    [html content removed, causing display issues in the thread]

    in tags and it works fine. The only issue is when the poster go's back to edit the text or what ever,,, the photos do not display again on the next preview. they need to be uploaded again to be previewed, is there a work around?

    Posted 12 years ago on Wednesday April 4, 2012 | Permalink
  39. I have updated the documentation to handle the issue when going back to the previous page and redisplaying the image when they click next again.

    Posted 12 years ago on Thursday April 5, 2012 | Permalink
  40. Ok cool now there is a question about the 2012 defalt wp- theme the hook works perfect in our current theme but the theme is giving us issue with CSS we then tested the hook in the 2012 default theme and cant get it to work all setting were left the same. Any ideas? playing with it for a week

    Posted 12 years ago on Wednesday April 11, 2012 | Permalink
  41. Any luck?

    Posted 12 years ago on Thursday April 12, 2012 | Permalink
  42. This is very exciting! Been hoping for this for a long while.

    One thing I noticed is "Admin Only" fields are displaying on the second page. I am trying to find out how to avoid this with an if statement. I can not find out how to recognize admin only fields.

    Luckily for this current project most of the admin fields are custom post types so I was able to hide them by $field["type"] but maybe its something you might want to consider adding in the future?

    Posted 12 years ago on Friday April 13, 2012 | Permalink
  43. I just ran some more tests and if I use this function "Address" fields dont get submitted and are blank, does that make any sense?

    Posted 11 years ago on Monday April 23, 2012 | Permalink
  44. For those of you interested in a simple pre-submission confirmation/preview page, you might find this snippet useful:

    http://gravitywiz.com/2012/04/30/simple-pre-submission-confirmation/

    If you have questions/suggestions for this snippet, please share them int the snippet's comment section.

    Posted 11 years ago on Saturday May 5, 2012 | Permalink
  45. snails007
    Member

    I would also like to know we could hide the admin only fields using Dana's code on this page - http://www.gravityhelp.com/documentation/page/Gform_pre_render.
    Also, multi select fields are only returning ‘Array’. How can I get the values out of the array?
    Any ideas?

    Thanks

    Posted 11 years ago on Monday June 4, 2012 | Permalink
  46. Subscribing this topic

    Posted 11 years ago on Friday June 8, 2012 | Permalink

This topic has been resolved and has been closed to new replies.