Sauter la 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 1 année et 2 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.

Ce sujet contient 1 voix et a 0 réponses.

>
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 $
});