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.

Print Submitted Form With Original Styling/Layout

  1. Greetings all,

    I'm searching for any clues on how to print a submitted form WITH the original styling intact. I've successfully hacked together parts of print-entry.php to get this working, but I've hit some snags.

    Here's my code thus far:

    add_filter('gform_field_value_field_9', 'field_9');
    function field_9($value){
    	$display_empty_fields = true;
    //use the function name to match the field id
    	$field_id = __FUNCTION__;
    	preg_match('@^(?:field_)?([^/]+)@i', $field_id, $matches);
    	$field = $matches[1];
    //get value of field
    	$value = RGFormsModel::get_lead_field_value($lead, $field);
    	$display_value = GFCommon::get_lead_field_display($field, $value, $lead["currency"]);
    	$display_value = apply_filters("gform_entry_field_value", $display_value, $field, $lead, $form);
    	if($display_empty_fields || !empty($display_value) || $display_value === "0"){
    	    $is_last = $count >= $field_count && !$has_product_fields ? true : false;
    	    $last_row = $is_last ? " lastrow" : "";
    	    $display_value =  empty($display_value) && $display_value !== "0" ? " " : $display_value;
    	    $content = ''.$display_value.'';
    	    $content = apply_filters("gform_field_content", $content, $field, $value, $lead["id"], $form["id"]);
    //echo works, return doesn't
    	return $content;

    It generates any value for a specified $field_id just fine, but it chokes on the return to dynamically populate the actual fields. It also will not return checkbox values, which I understand is a function of text values vs checked/not checked states. can it be done? I really want to stay close to the metal on this, but I'm willing to keep coding if needed. I just need a way for my client to hit "Print" in the admin and see a fully-filled form that looks like the original template. I need this method to work, or to find a new way to go about it. Any ideas?

    Note: I'm working on one project right now, but there's at least one more developer's license to purchase for new clients if we can figure it out. :)

    Thanks for your time.

    Posted 7 years ago on Thursday March 15, 2012 | Permalink
  2. *bump*

    Still struggling with this - any ideas thus far?

    Posted 7 years ago on Tuesday March 20, 2012 | Permalink
  3. Nickel

    I'm about to start this project myself... did you figure it out, and if not, can someone help?

    Posted 6 years ago on Wednesday August 1, 2012 | Permalink
  4. @Nickel, what are you trying to accomplish? Offer a print version of the entry where it looks like the form that was filled out?

    Posted 6 years ago on Thursday August 2, 2012 | Permalink