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!

Futureproof and dynamically created button

PaavoJan 13 2014 — edited Jan 15 2014

I have been looking solution how to make buttons dynamically so that I can fetch dynamically values for buttons:
- value,onclick,class,type,request
This excellent page has very closely what I am looking: http://www.laureston.ca/2012/04/20/simple-workflow-implementation-in-apex/
but I have challenges getting the escaped special characters to work especially for the apex.submit - part.
Maybe that is just because 'copy-pasting' the plsql-region code from www-page didn't work out of the box

Application Express 4.2.3.00.08

Because dealing with the escape chars make the page easily break and there are now the new dynamic actions, I need to check what would be futureproof way of dynamically creating the buttons.
If this is anyway the most practical way to proceed, then where I should look for further information about htp.p(....) button creation examples with rich escapes?

Made small test page, where you can see one of my trials trying to get the escapes right.
user test
pass test
http://apex.oracle.com/pls/apex/f?p=1403:2

rgrds paavo

--below the code for dynamic plsql region -- very likely the escape chars are not copypasted and shown correctly:

DECLARE
--PL/SQL Dynamic Region
--thisworks too??
  v_showme varchar2(3000);
 
BEGIN
  for c in (select sysdate||'asdasd;asdasas'  as button_label
            , 'PIMREQUEST'  as button_request
            , 'button-gray' as button_class
            , 'button'      as button_type
            , 'P38_XPIMPOM' as button_setme
            , 'JUUSTOA'     as button_setme_value
           
            from dual) loop

htp.p('<button value='''||c.button_label||''' onclick=\"apex.submit('''||c.button_request||''');'' class='''||c.button_class||''' type='''||c.button_type||'''>
<span>'||c.button_label||'</span>
</button>');

  end loop;
END;

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 12 2014
Added on Jan 13 2014
16 comments
1,514 views