Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 973661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:18:44+00:00 2026-05-16T03:18:44+00:00

the result i want is a textarea that hooks up to WMD (markdown editor).

  • 0

the result i want is a textarea that hooks up to WMD (markdown editor). and include a div.wmd-preview element. what i have currently is in my forms (extending Zend_Form) … i add the functionality thru decorators

// init()
$this->addElement('textarea', 'bio', array(
    'label' => 'Bio',
    'description' => '<a href="http://daringfireball.net/projects/markdown/syntax" target="_blank" title="get markdown editing/syntax help">Markdown enabled</a>',
    'validators' => array(
        array('StringLength', false, array(0, 1000))
    ),
    'decorators' => array(
        'ViewHelper',
        'Errors',
        array('Description', array('tag' => 'p', 'escape' => false)),
        'Label',
        array('HtmlTag', array('tag' => 'p')),
        new Application_Form_Decorator_WmdPreview,
     )
));
...
// add WMD & Prettify
$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
$view = $bootstrap->getResource('view');
$view->headScript()->prependFile($view->baseUrl("/js/wmd/wmd.js"))
                   ->prependScript('wmd_options = {"output": "Markdown"};')
                   ->prependFile($view->baseUrl("/js/prettify/prettify.js"));
$view->headLink()->prependStylesheet($view->baseUrl('/js/prettify/prettify.css'));
}

but if i want most textareas to be wmd-enabled, i think it might be better to encapsulate all these in a separate class? or somekind of wrapping element? either way, it will be nicer if i can do something like

$this->addElement(new Application_Form_Element_WmdEditor); 

or something similar

if the answer is to create a custom Zend_Form_Element, how do i go abt doing it? just create a custom view helper that contain all that markup? what if i want other decorators like errors and description to be put inbetween the textarea and the preview div?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:18:45+00:00Added an answer on May 16, 2026 at 3:18 am

    Create a new form element class that extends Zend_Form_Element_TextArea:

    final class Application_Form_Element_WmdEditor extends Zend_Form_Element_TextArea {
        public $helper = 'WMDEditor';
    }
    

    And then like you say a view helper:

    final class Application_View_Helper_WMDEditor extends Zend_View_Helper_FormElement {
    
         public function WMDEditor($name, $value = null, $attribs = null) {
            //set it up here
         }
    }
    

    This way you also have all the advantages of the standard form element helpers

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a HTML <textarea> that I want to be able to make when
I'm doing a kinect Application using Kinect SDK . The Result I want that
I have a while and foreach loop that I want to use to print
Im using FCK Editor control instead a textarea element. I installed it without problems.
I want my textarea controls to follow standard block display layout behavior, so that
I have a list in a string, as below (from a <textarea> element with
I have a mobile website form that I want to add type attributes to
I have a TextArea that allows user input. I also have TextInput that the
I have a page that contains multiple textarea elements. These textareas and the IDs
i search online but can't get satisfactory result i want to protect images on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.