0

I need to create a content type that is similar to a textarea, but I need to do some server side formatting before it can go out to the page.

I want a user to be able to input a chunk of text, then if it's a link of a certain type, leave it be, if it's not a link, create a link of sorts out of it with some server side (PHP) magic.

Can this be done in Drupal? Can someone point me in the right direction?

0

If I understand well your question, I guess that you can use Field validation module http://drupal.org/project/field_validation for validate fields in Drupal 7

This module adds an extra tab to each field instance, allowing you to specify validation rules for your field instances.

By using the hooks provided by this module, you can also define your own validation rules in your own modules.

this link could be useful to read about write complex rules to your field with Field validation module http://www.lullabot.com/articles/module-monday-field-validation

if you are a developer, RichForm http://drupal.org/project/richform is another module for validate fields:

This module gives you a framework to easily make client side and server side validation in the same time. It increases the validation features of the Drupal Form API (FAPI). If you want to have a powerful tool for creating custom validation logic to any text field, without writing a tons of codes, this module is for you!

Also, Form API Validation seems a possible alternative http://drupal.org/project/fapi_validation

0

Yes this can be done.

For the processing you'll need a custom module. Here's a tutorial to get you started with modules.

As for the specific functions you'll need all revolve around hook_nodeapi (d6) or node api hooks (d7).

2
  • All I need is to do some processing/formatting to the input that the user provides, then everything else should fit right in. Isn't creating a module for this overkill? Can't I just add a line or two of code to an existing module? – qwertymk Oct 3 '11 at 5:29
  • If you add a few lines of code to an existing contrib module what happens when you upgrade it in the future? You'll have to re do your change again, general rule of thumb is not to hack core or contrib. – digital Oct 3 '11 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.