Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Rich text editor via apex_item

Bas de KlerkOct 1 2024 — edited 5 days ago

Oracle APEX 23.2.6

Hi,

I'm trying to use a rich text editor via apex_item. Only a text area is supported by apex_item and this works fine.

So this generates a “classic report” with an input field of type textarea:

select  
  apex_item.textarea(p_idx => 1, p_value=> null, p_attributes=> 'id="textarea2_' || rownum || '"' || 'style="width:100%;" maxlength="3000"')     
    OPMERKING
from dual;

Now I would like to change that field to a rich text editor, prefferably the default one included in apex ( using an external lib I got this to work but I would like to use the included version in apex ).

Not sure how to do that so I asked my digital assistant Chat who suggested to customize it via JS by using apex.item.create after loading of the page. This does not work ( in my apex versions at least ). Nothing happens.

var elements = document.querySelectorAll('textarea[name="f01"]'); 
console.log('Number of elements found:', elements.length); 

elements.forEach(function(textarea) { 

    // Initialize Rich Text Editor using APEX API 
    apex.item.create(textarea.id, { 
    type: "RICH_TEXT", 
    height: "300px", 
    toolbar: [ 
    "undo redo | formatselect | bold italic backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat" 
    ], 
    plugins: [ 
    "advlist autolink lists link image charmap print preview anchor", 
    "searchreplace visualblocks code fullscreen", 
    "insertdatetime media table paste code help wordcount" 
    ], 
    menubar: false 
    }); 
});

The console logs that an element is found, no errors are reported but the item stays a plain text area.

Any ideas on how to fix this?

Kind regards

Bas

Comments
Post Details
Added on Oct 1 2024
0 comments
47 views