Skip Navigation

[Resolved] How to display a CRED form in a layout

This thread is resolved. Here is a description of the problem and solution.

Problem:
How can I display a CRED form in a Layout?

Solution:
We suggest to use the CRED cells for this.

If you want to display a Link to a form, you should use the Visual Editor Cell to insert the Link.

If you display the link in a content template cell, you need to also call a Post Body to let CRED replace that post body.

Relevant Documentation:
https://toolset.com/documentation/user-guides/cred-form-cell/
https://toolset.com/documentation/user-guides/creating-cred-forms/

This support ticket is created 8 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 7 replies, has 2 voices.

Last updated by chrisO-8 8 years, 1 month ago.

Assisted by: Beda.

Author
Posts
#421687

I am trying to: Use CRED to edit CPT within a nested layout.
When I add the edit form link I just return back to the view of the CPT, not an edit version.

I've tried following the instructions here: https://toolset.com/forums/topic/how-to-apply-layout-to-cred-edit-form/#post-278461

I also looked at this post but couldn't identify what I needed to change: https://toolset.com/forums/topic/cred-edit-form-not-working-in-a-layout/

However I don't think I'm understanding correctly.

I set-up a view to list all the CPT. This view is working correctly and appends the post ID to the URL:

Loop Output:

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<ul class="wpv-loop js-wpv-loop">
		<wpv-loop>
			<li>[wpv-post-body view_template="loop-item-in-main-canvas-view-copy"]</li>
		</wpv-loop>
	</ul>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

and the template for this view:

<a href="[wpv-post-url]?post_ids=[wpv-post-id]">[wpv-post-title]</a>
[wpv-post-excerpt]

Here is the view that is embedded in the layout for displaying the CPT:

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
		<wpv-loop>
          <hr />
<p>[wpv-post-excerpt]</p>
<hr />
<table class="wdn_responsive_table flush-left"  id="sample_table">
<caption></caption>
<tbody>

      <tr>
            <td colspan="1" id="row_1col_0">Problem<BR>[types field='problems'][/types]</td>
            <td colspan="1" id="row_1col_1">Solution<BR>[types field='solution'][/types]</td>
            <td colspan="1" id="row_1col_2">UVP</td>
            <td colspan="1" id="row_1col_3">Unfair Advantage</td>
            <td colspan="1" id="row_1col_4">Customers<BR>[types field='customers'][/types]</td>
       </tr>
</tbody>
</table>
<hr />
[cred_link_form form='17' form_name='Edit Form for Canvases' text='Edit %TITLE%' target='_self']
		</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

What have I got wrong? I've tried nesting the content template in the layout instead of a view but that didn't produce the required result either.

Thanks

#421713

Whenever you try to use a CRED Edit Link in a Content Template or View Cell, in a Layout, this will not work.

It's a known BUG.

The only way to use CRED Edit Forms right now in the Layout, is to either insert the Link to a Visual Editor Cell or to use the CRED Edit Cell directly.

You can read more in regard here:
https://toolset.com/forums/topic/post-form-edit-not-working-cred-preview-shows-blank-page/

It has been reported and we are working on solutions.

May I help you otherwise meanwhile?

#421784
Screen Shot 2016-08-03 at 9.58.41 PM.png
Screen Shot 2016-08-03 at 9.58.16 PM.png

Ok thanks. I have now got the edit function working. However, when I click the edit link the form is inserted inside the content template. See screenshot for example. It's hard to show in one image, but the form is being inserted inside one of the table cells and constrained by it.

The form appears in the 'problem' cell, so I assume the form is just finding the first [types field] and starting the form from there?

Here is my content template code, which is nested into the layout:

[cred_link_form form='17' form_name='Edit Form for Canvases' text='Edit %TITLE%' target='_self']
<hr>
<p>[wpv-post-excerpt]</p>
<hr>
<table class="wdn_responsive_table flush-left" id="sample_table">
<caption></caption>
<tbody>

      <tr>
            <td colspan="5" id="row_0col_0">Purpose</td>
       </tr>


      <tr>
            <td colspan="1" id="row_1col_0">Problem<br>[types field='problems'][/types]</td>
            <td colspan="1" id="row_1col_1">Solution<br>[types field='solution'][/types]</td>
            <td colspan="1" id="row_1col_2">UVP</td>
            <td colspan="1" id="row_1col_3">Unfair Advantage</td>
            <td colspan="1" id="row_1col_4">Customers<br>[types field='customers'][/types]</td>
       </tr>


      <tr>
            <td colspan="1" id="row_2col_0"></td>
            <td colspan="1" id="row_2col_1">Key Metrics</td>
            <td colspan="1" id="row_2col_2"></td>
            <td colspan="1" id="row_2col_3">Channels</td>
            <td colspan="1" id="row_2col_4"></td>
       </tr>


      <tr>
            <td colspan="2" id="row_3col_0">Cost structure</td>
            <td colspan="3" id="row_3col_3">Financial Sustainability</td>
       </tr>


      <tr>
            <td colspan="5" id="row_4col_0">Impact</td>
       </tr>

</tbody>
</table>
<hr>
#422033

As I mentioned, the CRED Edit ShortCode can not be called in a Content Template unless you follow a few extra steps.

Please find here an elaborate explanation:
https://toolset.com/forums/topic/post-form-edit-not-working-cred-preview-shows-blank-page/#post-422031

#424365
Screen Shot 2016-08-13 at 3.45.40 PM.png
Screen Shot 2016-08-13 at 3.45.28 PM.png

Sorry I do not seem to be able to follow the instructions to make this work. Here is what I have in a visual editor cell, within a layout:

<p>[cred_link_form form='17' form_name='Edit Form for Canvases' text='Edit %TITLE%' target='_self']</p>
<hr>
<p>[wpv-post-excerpt]</p>
<hr>
<table class="wdn_responsive_table flush-left" id="sample_table">
<caption></caption>
<tbody>
<tr>
<td colspan="5" id="row_0col_0">Purpose</td>
</tr>
<tr>
<td colspan="1" id="row_1col_0">Problem<br />
[types field='problems'][/types]</td>
<td colspan="1" id="row_1col_1">Solution<br />
[types field='solution'][/types]</td>
<td colspan="1" id="row_1col_2">UVP</td>
<td colspan="1" id="row_1col_3">Unfair Advantage</td>
<td colspan="1" id="row_1col_4">Customers<br />
[types field='customers'][/types]</td>
</tr>
<tr>
<td colspan="1" id="row_2col_0"></td>
<td colspan="1" id="row_2col_1">Key Metrics</td>
<td colspan="1" id="row_2col_2"></td>
<td colspan="1" id="row_2col_3">Channels</td>
<td colspan="1" id="row_2col_4"></td>
</tr>
<tr>
<td colspan="2" id="row_3col_0">Cost structure</td>
<td colspan="3" id="row_3col_3">Financial Sustainability</td>
</tr>
<tr>
<td colspan="5" id="row_4col_0">Impact</td>
</tr>
</tbody>
</table>
<hr>

When clicking the edit link it just reloads the page, without the edit link.

#424511

This is strange.

Being this in a Visual Editor Cell, it should work.

Can you show me this in your Site and grant me accesss?

I will also need to edit the code and make some tests, if you coudl allow me that.

I would then need to request temporary access (WP-Admin and FTP) to your site
- preferably to a test site where the problem has been replicated if possible -
in order to be of better help and check if some configurations might need to be changed

Your next answer will be private which means only you and I have access to it.

❌ Please backup your database and website ❌

✙ I would, if possible, need access to a site where only a minimal set of Plugins and a default theme is active.
This to avoid eventual compatibility issues with other software.

✙ I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site.
This is also a reason the backup is really important

✙ Please add the Links to:

- The Layouts Edit Screen

- The Page/Post where you use the Layout

#424567

It is strange, on your system this does not work.

But there is a nice solutiuon.

1. I cretaed a New Content Template "Toolset Test"

2. This Content Template holds the Link to the Form:

[cred_link_form form='17' form_name='Edit Form for Canvases' text='Edit %TITLE%' target='_self']

3. It holds a Post Body ShortCode as we need this to display the Form:

[wpv-post-body view_template='None']

4. This Post Body is wrapped in a Conditional so it applies only if you actually call the Form.
I have done this with the ShortCode HTML evaluting the search Term:

[wpv-conditional if="( '[wpv-search-term param='cred-edit-form']' eq '17' )"][wpv-post-body view_template='None'][/wpv-conditional]

So now if you visit:
hidden link
And click on edit, you will see the form IN the Layout of course.

Does that solve the problem?

#424675

Thank you for the excellent support.

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.