Skip Navigation

[Résolu] Ninja form shortcode does not work in template – Also affects existing views

This support ticket is created Il y a 7 années et 5 mois. 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Marqué : 

This topic contains 6 réponses, has 2 voix.

Last updated by Nigel Il y a 7 années et 4 mois.

Assisted by: Nigel.

Auteur
Publications
#446625

I am trying to: Add a ninja Form to every page on the custom post type 'Booking Forms'. On each page, I am adding a form shortcode inside the body.

If I add a simple ninja form with the fields name, email, mobile, the form loads.

Problem: It the form has a drop down field, the form does not load.

This happens only if I create a content template for 'Booking Forms' CPT. If I delete the content template and use the default theme template, and place the form shortcode in the body, the form loads properly.

Related problem:
Evert time I tried to do add a form in the content template, all my existing views were affected.

The 'Templates for this View' section where I add the fields and css etc for the view disappears. I had to recreate the views twice as I tried to add a form to the content template twice. both the times, my views stopped working.

#446681

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+00:00)

Screen Shot 2016-10-14 at 14.02.31.png

I thought this may be related to the update to the current version of the select2 jQuery library in our latest plugin versions and a possible conflict with Ninja Forms.

But I downloaded the latest version of Ninja Forms and added it to a test site with the current version of our plugins and couldn't reproduce the issue.

You can see in the screenshot a test form I created. I inserted the shortcode for the form into a Content Template which I assigned to single posts of a custom post type called Booking Forms, as per your description.

The form loaded (and submitted) without problem.

I'm using the free version of Ninja Forms, so I don't appear to be able to add Types custom fields to the forms, I am adding a manually created select dropdown. I don't know what content you are including on your form.

Can you try a few things.

Firstly, are there any errors when you try to load the page with the form (when the form shortcode is added to the content template)? Either JavaScript errors in the browser console, or PHP errors in your debug logs.

Second, can you clear your browser cache and try again? (If you use Chrome then when you have the developer tools open, you can long-click on the browser reload button and choose clear cache and hard reload.)

Third, can you disable all plugins except for Types, Views, and Ninja Forms and re-test to rule out conflicts with other plugins.

Let me know how you get on so I can see how to proceed.

#446810
Screen Shot 2016-10-14 at 11.50.03 PM.png
Screen Shot 2016-10-14 at 11.51.57 PM.png

Hi Nigel,

Sorry I did't explain clearly. I am not adding the form shortcode directly inside the content template.

I am adding the form shortcode inside a WYSIWG field in the 'Booking Forms' CTP.

In the content template for Booking Forms, I have added the WYSIWG field.

Can you try this as well please.

Thanks in advance for the help.

#447427

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+00:00)

Hi Prasad

I re-tested accordingly, with the Ninja Form shortcode added to a WYSIWYG custom field which is then shown on the single Booking Form content template and confirm the problem.

One question before I go any further.

Is the custom field just for adding the Ninja Form shortcode or does it do anything else?

If I change the custom field so that it is a single line text field and add the shortcode there then it works fine.

#449297

Hi Nigel,

Apologies for the delay in replying.

The custom field is just for adding the form shortcode. (I am using a WYSIWYG field as I can add more content / useful info if required in the future).

How do I solve this issue? Please let me know if possible.

Thanks a lot in advance.

#450112

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+00:00)

Hi Prasad

This particular case (adding the Ninja shortcode for a form containing a select box via a WYSIWYG custom field) is a compatibility issue between Views and Ninja Forms and I have escalated this thread so that it can be investigated further and a fix identified.

I'll let you know as and when there is any progress.

In the meantime you can add the shortcode via a standard text custom field, or directly in the content template for your custom post type single posts.

Thanks for your patience.

#452655

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+00:00)

Hi Prasad

With further testing we found that where you insert the shortcode in your content template to output the WYSIWYG field, if you add the attribute output='raw' to the shortcode then the form will render correctly even if it contains a select box.

I hope that resolves the problem for you.

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