简体   繁体   中英

Customize WebForm module in Drupal

I'm new to Drupal 6.10 CMS and PHP too. I'm creating my website with drupal and I have found a module called Webform I like it, it's pretty easy to create forms with different types of fields and file uploading. The one thing that i can't figure out is how to add Rich Text before all fields. Something like introduction to the form. This module has "Description" field that will show text as a plain text but it doesn't have rich text in it.

What can I use to make that happen. Is it possible to hardcode html there or is there any other modules that can allow to do something like that?

Thanks

the value of the "Description" field is passed through _webform_filter_descriptions() . this function has a $strict parameter, defaulting to TRUE , which determines if the description is filtered through filter_xss() or not. filter_xss() allows some html:

'a', 'em', 'strong', 'cite', 'code', 'ul', 'ol', 'li', 'dl', 'dt', 'dd'

so you can either restrict your "rich text" html to these elements, or modify _webform_filter_descriptions(), setting $strict to FALSE . if you do latter, be aware of the security implications (users with rights to create webform descriptions could enter malicious html - that's what filter_xss() protects against).

我认为您需要做的就是将“输入格式”设置为“完整html”,然后可以使用任何要设置文本样式的HTML / CSS标签。

You can achieve this by the creating a Form Component " MARKUP " from the drop down option when creating new fields.

From this part, you are able place html and php in this box as you desire.

You also have the ability to choose input format to have more control over how you want to work with this element.

As the OP says, the "Confirmation" box shows up with the WYSIWYG editor toolbars, but the "Description" box does not.

The simplest way to deal with this is simply to handcode the HTML you want in the Description box. While nowhere does it say you can do this, you can, and it works.

Here is a short howto I wrote on getting custom code to run with Webform. It details writing a custom module, copying the Webform template to match the nodeID, and adding custom javascript/jquery for form processing.

http://docs.quantact.com/drupal-webform-custom-php-code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM