We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1570
    • 38 Posts
    HI,

    i would like to have multiple richtext editors in a module i am coding. I had amnaged to do this with modx version 1.0.3 however when i updated the installation it stopped working and only the last textarea in the module is being rendered as a richtext editor. My code is as follows:

    // Output english review 
    	echo'<div id="english">';
    	$event_output = $modx->invokeEvent("OnRichTextEditorInit", array('editor'=>$modx->config['which_editor'], 'elements'=>array('tvreview_en')));
    
    	if(is_array($event_output)) {
    		$editor_html = implode("",$event_output);
    	}
    	$rte_html = renderFormElement('richtext', 'review_en', $reviews_row[review_en], '', '');
    	
    	echo $rte_html;
    	echo $editor_html;
    	echo'</div>';
    	
    	// Output Italian review 
    	echo'<div id="italian">';
    	$event_output = $modx->invokeEvent("OnRichTextEditorInit", array('editor'=>$modx->config['which_editor'], 'elements'=>array('tvreview_it')));
    
    	if(is_array($event_output)) {
    		$editor_html = implode("",$event_output);
    	}
    	$rte_html = renderFormElement('richtext', 'review_it', $reviews_row[review_it], '', '');
    	
    	echo $rte_html;
    	echo $editor_html;
    	echo'</div>';
    	
    	// Output Serbian review 
    	echo'<div id="serbian">';
    	$event_output = $modx->invokeEvent("OnRichTextEditorInit", array('editor'=>$modx->config['which_editor'], 'elements'=>array('tvreview_rs')));
    
    	if(is_array($event_output)) {
    		$editor_html = implode("",$event_output);
    	}
    	$rte_html = renderFormElement('richtext', 'review_rs', $reviews_row[review_rs], '', '');
    	
    	echo $rte_html;
    	echo $editor_html;
    	echo'</div>';
    	
    	// Output Swedish review 
    	echo'<div id="swedish">';
    	$event_output = $modx->invokeEvent("OnRichTextEditorInit", array('editor'=>$modx->config['which_editor'], 'elements'=>array('tvreview_se')));
    
    	if(is_array($event_output)) {
    		$editor_html = implode("",$event_output);
    	}
    	$rte_html = renderFormElement('richtext', 'review_se', $reviews_row[review_se], '', '');
    	
    	echo $rte_html;
    	echo $editor_html;
    	echo'</div>';


    As you can see i am trying to render 4 richtext boxes, however only the last one is being rendedred, the other 3 are showing up as normal text areas.

    Any advice would be very much welcomed.

    Thank you very much smiley
      • 1570
      • 38 Posts
      Please help me on this one guys
        • 4310
        • 2,310 Posts
        Try giving each instance of your set of $rte_html & $editor_html unique names