Skip Navigation

[Résolu] Use Javascript to pre-populate the tinymce post_content field on a cred form

This support ticket is created Il y a 5 mois et 1 semaine. 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.

This topic contains 0 réponses, has 1 voix.

Last updated by Gavin Il y a 5 mois et 1 semaine.

Auteur
Publications
#2665839

Hello

I would like to pre-populate the post_content field on a cred form with the post content where the form is inserted.

I know I can use the value attribute:

[cred_field field='post_content' output='bootstrap' value="[wpv-post-body view_template='None']"]

And this works. However, I would like to be able to format the content, e.g. add extra content and HTML tags.

I know that tinymce fields can be pre-populated using Javascript on the form itself.

I have tried the following but it does not work:

jQuery(document).ready(function() {
tinyMCE.activeEditor.setContent('<p>Some content</p>');
});

Any help would be greatly appreciated.

Many Thanks.

#2666047

I eventually found a solution here:

https://toolset.com/forums/topic/struggling-with-js-client-side-form-validation/

The correct code is:

jQuery(window).bind('load', function() {
// Your custom validation code goes here using jQuery instead of $
});

Gavin confirmed that the issue was resolved on 2023-11-18 09:16:25.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.