I need to create a custom submission confirmation page that has an embedded view. I can create my custom page no prob using the PHP content filter. However, for some reason the views_embed_view function is not working here. I expected that it should work the same as with any node, but I'm getting no results on the page and Chrome's Console is not popping any errors.

For the submission confirmation page I have the following code in the body content using the PHP filter:

<h2>Here in the information you just submitted:</h2>
<?php 
$a=$_REQUEST['entityform_id'];
echo "The value of the ref parameter is ".$a;
print views_embed_view('data-entry-summary','page', $a); 
?>

The view doesn't appear, but the entityForm ID does print, so I know I'm catching that. When I remove the parameters from the views_embed_view function call using the following code, just to show the plain View to see if even that is working, it still doesn't show - just getting blank and nothing reporting in the Chrome Inspect Console.

<h2>Here in the information you just submitted:</h2>
<?php 
$a=$_REQUEST['entityform_id'];
echo "The value of the ref parameter is ".$a;
print views_embed_view('data-entry-summary');  // ,'page', $a); 
?>

Any suggestions....?

Comments

hondaman900 created an issue. See original summary.

joelpittet’s picture

This sounds like a security nightmare with PHP filter turned on, unsanitized REQUEST variables... to be honest I'm scared to offer help EDIT: not constructive.

This may be a bug though, _entityform_format_text() codes check_markup() but the $format variable is not defined, which may be why that filter is doing nothing.

Try this issue it may be related, but don't see it helping the problem, yet still worth a try
#2861920: Text filter tokens broken

joelpittet’s picture

Priority: Major » Normal
Issue tags: -views, -form submission

Support request's aren't major btw

niraimani’s picture

Issue tags: +views embed view

I have the similar requirement in one of my project and used the table format in my view. Please change below your code and let me know if you still facing an issue.

$a = $row['fields']['entityform_id'];
echo views_embed_view($name = '<>', $display_id = 'machine_name of your view page', $a);

hondaman900’s picture

Thanks guys.

@niraimani, did you have this same issue in the submission confirmation page for an entityForm or in some other form of entity or node? I tried your suggested code but it made no difference and the $row['fields']['entityform_id']; reference doesn't return the entity ID.

@joelpittet Looks like this will not work then with entityForms. I think I'll try to resort to creating a view block, placing it only on confirmation pages, and using a contextual filter using PHP, then insert PHP to parse the entityform ID from the page URL and return it as the contextual value so that the view only pulls up that record. Not sure if this will work yet but can't think of another way to get a custom summary page for an entered record.

Thoughts?

niraimani’s picture

@hondaman900 - Have you included the entityform_id (Entityform submission ID) field in your view ?

hondaman900’s picture

Yes indeed. It is a field in the View and is used as a contextual filter to apply the View to a specific single entityForm submission. For example
http://mysite.com/data-entry-summary/153
works fine to load the View displaying only submission with entityForm-ID 153.

This PHP code is in the confirmation page content (PHP format) for an EntityForm. The user completes the form and on submit they get a thank-you-confirmation page. I want to embed this View in that page, as one would in any node, but it's no working. I think your reference to the entity-ID is for Views (using the row reference) but not for the page I'm trying to get the View into. The code:
$a=$_REQUEST['entityform_id'];
does return the entityform-ID value as it directly pulls it from the new entityForm just created. Does this help clarify?