Skip Navigation

[Gelöst] Disable Wysiwyg editor for post content in CRED/ Forms

This support ticket is created vor 3 Jahren. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

Dieses Thema enthält 5 Antworten, hat 3 Stimmen.

Zuletzt aktualisiert von Nigel vor 3 Jahren.

Assistiert von: Nigel.

Author
Artikel
#2211857

I created a "create content" form and an "edit content" form with CRED/ forms.

I DO NOT want the wysiwyg editor.

I use this solution from this thread to use a generic field to enter the post_content:
https://toolset.com/forums/topic/disabling-rich-text-wysiwyg-editor-on-certain-forms-form-fields-completely/

[cred_generic_field field='post_content' type='textarea' class='' urlparam='']
{
"required":1,
"validate_format":0,
"default":""
}
[/cred_generic_field]

When I use this generic field in the "edit content" form. I does not load the post content, so it could be edited.
I tried to use a shortcode in the defaults field to show the current value but thisthen shows the HTML (which has never been entered):

[cred_generic_field type='textarea' field='post_content']
{
"required":1,
"validate_format":0,
"default":"[wpv-post-body view_template="None"]"
}
[/cred_generic_field]

I want users to save and edit the post content without that horrible WYSIWYG editor. I want to keep linebreaks, but that's pretty much it. No one should be allowed to enter HTML or anything.

I hope you have an idea what I could do.

Thanks in advance 🙂

#2211941

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Konstantinos,

Thank you for getting in touch.

Try using [wpv-post-body] instead of [wpv-post-body view_template="None"]

Please let me know if this helps.
Thanks,
Shane

#2211943

Nigel
Supporter

Sprachen: Englisch (English ) Spanisch (Español )

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

I tested this on my own site and it worked okay.

I created a form to publish posts, and replaced the post content field with a generic field (slug post_content).

And I created a form to edit posts (which I added to an unassigned content template, then linked to from the content template for single Posts) which also replaced the post content field with a similar generic field, where the default value was provided by the wpv-post-body shortcode.

Note that where I added the generic field I included a "persist" option, which means that the field value will be saved. (Ordinarily they are not, and should be processed with server-side PHP using one of the Forms API hooks such as cred_save_data.)

Also you need to be mindful of how single and double quotes are mixed.

In the edit form the generic field looks like this:

[cred_generic_field type='textarea' field='post_content']
{
"required":0,
"default":"[wpv-post-body template='None']",
"persist":1
}
[/cred_generic_field]

That gave the result you say you are looking for, if you can try again.

Naturally, if you edit a post this way that was originally created using a WYSIWYG editor (front end or back end) then it will include HTML markup.

#2213629

My issue is resolved now. Thank you!

#2213633
Bildschirmfoto 2021-11-05 um 10.14.06.png

Sorry, the question "How easy was it to use the solution" had a range from 1- 5. I intuitively clicked 5 as it was "very easy". But 5 was labelled "very hard" which is not ideal from an evaluation perspective. I saw this after submitting.

Therefore, it got the wrong feedback. Cannot undo. Maybe you should consider inverting this range. A higher number means higher power to the attribute used in the question. So this is designed just plain wrong.

Furthermore, after reopening the ticket it asked me to give the feedback again, did that but got the following error:

ERROR: Duplicate reply detected; it looks as though you've already said that!
#2215577

Nigel
Supporter

Sprachen: Englisch (English ) Spanisch (Español )

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

Thanks for the feedback, I'll share that with the support manager.