Skip Navigation

[Resolved] Disabling rich text / WYSIWYG editor on certain Forms form fields completely

This support ticket is created 4 years, 9 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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 17 replies, has 2 voices.

Last updated by Vane 4 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1480531

Hi,

I'd like to disable rich text editor for certain form fields on frontend for all roles, (because Admins can also edit those fields from backend with that WYSIWYG editor).
The closest support thread is this:
https://toolset.com/forums/topic/hide-toolset-buttons-from-the-post-content-rich-text-editor-for-non-admins/
but I don't want to show any of these:
https://toolset.com/wp-content/uploads/2018/07/920415-screen_1.png
Checking Toolset custom fields I want to use text editor used for multiline text type and not WYSIWYG field type, but I can not set it neither in the form nor in any display of that form.
Pls . note it's good that CPT's default content field is WYSIWYG type and has a WYSIWYG editor at backend, but it isn't on frontend, when user creates or edits it via Forms forms!

You can see what I mean here:
hidden link

Thank you

#1480611
Create CPT form - BB_200127.png

Pls. see what I mean attached.

#1480699

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

In such case, to replace the existing post_content WYSIWYG field with the normal multiline field, you should simply edit your form and remove the existing post content field added using the [cred_filed] shortcode and replace that with the following generic field:

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

More info:
=> https://toolset.com/documentation/user-guides/front-end-forms/inserting-generic-fields-into-forms/

#1480745

Hi Minesh,

thank you for your solution.

I don't really understand: I edit form here:
https://toolset.com/wp-content/uploads/2019/02/forms-generic-fields.png
remove Post Content field,
but I don't find where can I add that shortcode you provided.
I tried to use WYSIWYG and Multiple Lines Generic Fields types,
I tried to add your shortcode to
"Default Field Value",
but that doesn't work.

Being able to set field editor type allowed for that specific field via checkbox here:
https://toolset.com/wp-content/uploads/2019/02/forms-generic-field-options.png
would be much easier for us though. 🙂

Thank you!

#1480753

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok - You should activate the "Expert Mode" that will allow you to edit the form manually, locate the post_content field added using the [cred_field] shortcode and replace that with the generic field shortcode I shared with you as given under:

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

Please check the following screenshot:
hidden link

Also, I would like to know, you want to replace the field on both create/edit forms? If yes, we need to set the default value while editing form. Please let me know if you also want to replace the WYSIWYG field on post edit forms as well.

#1480777
Create CPT form - BB_200127_p2.png

Yes, surely, so I want to disable it on both create and edit forms.

I don't want to allow these users to reach WYSIWYG editor in any content and field type on frontend,
and I don't want to allow them to reach the backend at all.

EDIT:
your shortcode worked properly, thank you!

EDIT 2:
screenshot #2 added

#1480795

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes, surely, so I want to disable it on both create and edit forms.
==>
Ok, so you need to follow the same steps I shared on both create/edit forms where you simply need to replace the post_content field added using the [cred_field] shortcode and replace that with the generic field shortcode I shared. As the form you created is frontend form the scope of that form is limited to frontend only.

I ran a test on my local test site and no adjustment required on edit form as well.

#1481407

It looks more complex than I thought...
So using your shortcode, when I click the edit form link and edit the existing content, the post content field's content looks like this:

<!-- wp:paragraph -->
<p>Stet corpora placerat cu vim! Has quot forensibus temporibus ei, eum an purto vidit animal, impedit eleifend et vis. Tantas utinam oportere ad pro! Per at case velit reprehendunt.</p>
<!-- /wp:paragraph -->

...but I'd like this:
Stet corpora placerat cu vim! Has quot forensibus temporibus ei, eum an purto vidit animal, impedit eleifend et vis. Tantas utinam oportere ad pro! Per at case velit reprehendunt.

so I don't know how to redefine it and move forward 🙁

#1482227

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

EDIT:
your shortcode worked properly, thank you!
==>
Great - glad to know that it works.

EDIT 2:
screenshot #2 added
==>
I understand your requirement and as you know for now there is no feature available but you are welcome to file a feature request using the following link:
- https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

So using your shortcode, when I click the edit form link and edit the existing content, the post content field's content looks like this:
<!-- wp:paragraph -->
<p>Stet corpora placerat cu vim! Has quot forensibus temporibus ei, eum an purto vidit animal, impedit eleifend et vis. Tantas utinam oportere ad pro! Per at case velit reprehendunt.</p>
<!-- /wp:paragraph -->
==>
It looks like you are using the block editor in the backend, I suggest you should use the classic editor in the backend. To switch to the classic editor, you should navigate to:
- Toolset => Post Types => Edit your post type => With the Editor (required) field chose the option "Classic" and save your post type.

#1482531

I changed that setting, logged out and in again, cleaned that post in backend (removed HTML in Classic Editor Text Mode), saved,
and after about half hour, a couple of page hard reloads (of edit form page) it looks working , except - I think - WPs auto paragraph.
So even if I start a new line of text (which looks correct in the editor before save), it doesn't display it in a new paragraph after saving.
I'm not sure, but I think it is WP auto paragraph, so how can I fix it?

#1482533

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Great 🙂

WP Autoparagraph is added from the backend as you are using the default WYSIWYG editor in the backend.

Please check the following article that might help you to remove the auto P:
=> hidden link
=> hidden link

#1482561

No, just the opposite! 🙂
I need the auto paragraph, which is removed in form editor ! 🙂

#1482565

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

The thing is that you can not match the WYSIWYG field with the multiline field. As WYSIWYG will offer you the auto paragraph etc..etc and once you edit that post content on frontend, you will not have WYSIWYG capabilities as you are editing the content using the multiline field.

WYSIWYG field in the backend should have auto P as with WordPress its enabled by default and we do not disable it.

Maybe you are editing the post content from the frontend and then you do not see the auto P in the backend after editing the post from frontend - is it true?

#1482577

It looks stange, but if I check it on backend, it looks OK.
You can check frontend:
hidden link
it looks 3 paragraphs on backend, (but without <p> tags!) even if I resize browser window!, always shows 3 paragraphs ( both in Visual and Text Mode!)
Frontend doesn't show that 3...

#1482589

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can I have access details so I can dive into your site and check what's going wrong?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually 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.

I have set the next reply to private which means only you and I have access to it.