1 2 Previous Next 15 Replies Latest reply on May 16, 2019 2:30 PM by Scott Wesley

    Adding html to breadcrump

    Javier Porrata

      Hi,

       

      In the P-Track sample application they add what it seems to be html code holding a field after the project name.

      Here is the screen:

      screen.jpg

      The AAC7 part.

       

      I tried to find where they do that and how but I haven't been able to find it or figure out how to do it.

       

      How can I achieve the same?  Where do they put the code?  Am using APEX 19.1

       

      Thanks for any help!
      Javier

        • 1. Re: Adding html to breadcrump
          fac586

          Javier Porrata wrote:

           

          Hi,

           

          In the P-Track sample application they add what it seems to be html code holding a field after the project name.

          Here is the screen:

          screen.jpg

          The AAC7 part.

           

          I tried to find where they do that and how but I haven't been able to find it or figure out how to do it.

           

          How can I achieve the same? Where do they put the code? Am using APEX 19.1

          It's done by generating the breadcrumb entry using a Dynamic PL/SQL Content region. See the Dynamic Breadcrumb region on the global page.

          • 2. Re: Adding html to breadcrump
            Scott Wesley

            Another solution is to populate a page item (eg P1_BC) with your button syntax, perhaps as generated from https://apex.oracle.com/pls/apex/f?p=42:6100:::NO:::

             

            <button type="button" class="t-Button">My Button</button>
            

             

            The edit your breadcrumb region and add the following to the short name.

            &P1_BC!RAW.
            

             

            Ensuring you have complete trust in the value of P1_BC, which is now a threat to XSS.

            • 3. Re: Adding html to breadcrump
              Javier Porrata

              Hi fac586

               

              Thanks for your reply!

               

              I see this is the code they are using:

                                      sys.htp.p(apex_escape.html(pj_rec.project)||' <span class="project-key-badge">'||nvl(pj_rec.code_name,pj_rec.row_key)||'</span></span></li>');

               

              However, what am doing is having an Application Item called Project_Breadcrumb and in the page BEFORE HEADER have a computation named Project_Breadcrumb type slq query (simple return value) with this query:

               

              select project_name from risk_projects where project_id = :P32_PROJECT_ID

               

               

              Also using that Application Item in the breadcrumb entry as &Application_Breadcrumb.       This way I get the project name in the breadcrumb.

               

              Is there any simple way to get the other field next to the project name on the breadcrumb with the html code?   the field is on the same table Risk_Projects.

              Also noticed that project-key-badge is a class defined in the Inline CSS of the page.

               

              Thanks

              Javier

              • 4. Re: Adding html to breadcrump
                fac586

                Javier Porrata wrote:

                 

                I see this is the code they are using:

                sys.htp.p(apex_escape.html(pj_rec.project)||' <span class="project-key-badge">'||nvl(pj_rec.code_name,pj_rec.row_key)||'</span></span></li>');

                 

                However, what am doing is having an Application Item called Project_Breadcrumb and in the page BEFORE HEADER have a computation named Project_Breadcrumb type slq query (simple return value) with this query:

                 

                select project_name from risk_projects where project_id = :P32_PROJECT_ID

                 

                 

                Also using that Application Item in the breadcrumb entry as &Application_Breadcrumb. This way I get the project name in the breadcrumb.

                 

                Is there any simple way to get the other field next to the project name on the breadcrumb with the html code? the field is on the same table Risk_Projects.

                What "other field" and "html code" are you referring to?

                • 5. Re: Adding html to breadcrump
                  Javier Porrata

                  The project number and the html code that is going to format the number as the one in the example.

                  • 6. Re: Adding html to breadcrump
                    Scott Wesley

                    Perhaps you'd like to re-visit my suggestion - generate the HTML you need, assign it to an item, and substitute the exact value within the breadcrumb.

                    • 7. Re: Adding html to breadcrump
                      fac586

                      Javier Porrata wrote:

                       

                      The project number and the html code that is going to format the number as the one in the example.

                      See Scott's suggestion above, noting the security implications.

                      • 8. Re: Adding html to breadcrump
                        Javier Porrata

                        Hi Scott,

                         

                        I dont quite understand where do you say I populate the html?

                         

                        I have the Application item and populate it in a computation in the before header section with this sql query (return single value);

                        select asegurado from risk_clientes where cliente_id = :P32_CLIENTE_ID

                         

                        Here I get the ASEGURADO which is the name part of the breadcrumb.   I want to add the number field in the button.  The number field is called CLIE_NUM

                         

                        How do I add the html with the number in the sql query next to the name part?   if there is a security concern, how do  I avoid it?

                         

                        Thanks for your help!!

                        Javier

                        • 9. Re: Adding html to breadcrump
                          Scott Wesley

                          I mean you could populate the item with the HTML necessary to render a button with the link to your item.

                           

                          Roughly:

                          '<button type="button" class="t-Button" href="f?p=your_app:your_page:&SESSION.:::P1_PARAM:'||:P32_CLIENTE_ID||'>My Button</button>'
                          

                           

                          You must ensure any content you don't trust is still transformed using something like the apex_escape package.

                          Grassroots Oracle: APEX attributes for Escaping Special Characters

                          • 10. Re: Adding html to breadcrump
                            Javier Porrata

                            Hi,

                             

                            How do I populate an item with the html code?

                             

                            Thanks for any help!

                            Javier

                            • 11. Re: Adding html to breadcrump
                              Scott Wesley

                              The same way you currently populate it, with a computation before header.

                              Except instead of using a SQL query, you could use a PL/SQL expression, or maybe your SQL returns a HTML string. Whatever you need.

                              1 person found this helpful
                              • 12. Re: Adding html to breadcrump
                                Javier Porrata

                                Hi Scott,

                                 

                                Thanks for taking the time.

                                 

                                Pardon my ignorance but what the code would be like in a PL/SQL expression?

                                 

                                Right now am just returning the value with this code:

                                select name from risk_customers where CUST_ID = :P32_CUST_ID

                                and the ITEM is automatically populate.

                                 

                                What I would like to use is the NAME and the NUMBER as showed above.   With the number in a button.

                                How do I get those fields assign them to the ITEM and return it from the PL/SQL code as HTML?

                                 

                                Thanks again!

                                • 13. Re: Adding html to breadcrump
                                  fac586

                                  Javier Porrata wrote:

                                   

                                  Pardon my ignorance but what the code would be like in a PL/SQL expression?

                                   

                                  Right now am just returning the value with this code:

                                  select name from risk_customers where CUST_ID = :P32_CUST_ID

                                  and the ITEM is automatically populate.

                                   

                                  What I would like to use is the NAME and the NUMBER as showed above. With the number in a button.

                                  How do I get those fields assign them to the ITEM and return it from the PL/SQL code as HTML?

                                  Use a SQL Query computation:

                                   

                                  select
                                      apex_string.format(
                                          '%s <a class="t-Button" href="%s">%s</a>'
                                        , apex_escape.html(c.cust_first_name || ' ' || c.cust_last_name)
                                        , apex_page.get_url(p_page => '200', p_items => 'p200_customer_id', p_values => c.customer_id)
                                        , c.customer_id) breadcrumb_entry
                                  from
                                      oehr_customers c
                                  where
                                      c.customer_id = 200
                                  
                                  1 person found this helpful
                                  • 14. Re: Adding html to breadcrump
                                    Javier Porrata

                                    Thanks a lot fac586 and Scott!

                                    1 2 Previous Next