This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 30th, when you will be able to use this site as normal.

    Forum Stats

  • 3,889,964 Users
  • 2,269,775 Discussions
  • 7,916,823 Comments

Discussions

Handling comma while passing the parameter values from 1 page to another

Niki Dilip
Niki Dilip Member Posts: 18 Blue Ribbon
edited Aug 4, 2022 2:03PM in APEX Discussions

I am facing a weird problem in APEX.

In page1, I created 2 pageitems of type textbox. Lets say P1_item_name and p1_description.I also created a submit button in Page 1. On submit i created branch to page2 and used a linkbuilder - target optionI created another page2 having 2 pageitem p2_item_name and p2_description where the data will be populated from the inputs in the page 1.

Now, when i enter a comma separated values in the page1 , in page2 only the value before comma is diplayed and value after comma is carryforwarded.

Eg: In p1_item_name i entered test,hello and p1_description as this,is,test,msg. On submit,

https://apex.oracle.com/pls/apex/r/test/test-for-comma/page1?p2_item_name=test&p2_description=hello&session=109231772756168&cs=1-Vby6GiNG

p2_item_name is populated as test , ideally it should be test,hello

p2_description as hello , ideally it should be this,is,test,msg

why is it not taking comma? If i use any other special character, it is working fine.

Any idea why is this happening? How to pass comma?

Thanks & Regards

Tagged:

Best Answers

  • Adnan3114
    Adnan3114 Member Posts: 13 Red Ribbon
    Answer ✓

    It's because of how URLs are set up. The commas in the URL indicates which items will get which values. We actually faced a similar problem and found a solution. You can use a pre-rendering process on the target page and set the values of the previous page item to the target page.

    Pre-rendering process (PL/SQL):

    :P2_item_1 := :P1_item_1;

    :P2_item_2 := :P1_item_2;

    And give it a server-side condition so it executes only when getting redirected from page 1. For this you can use a single extra item on the target page and set it's value from the Branch of previous page.

    Server-side condition:

    :P2_STATUS = 'EXECUTE' (set the 'EXECUTE' value from branch)

  • fac586
    fac586 Senior Technical Architect EdinburghMember Posts: 21,579 Red Diamond
    Answer ✓

    why is it not taking comma? If i use any other special character, it is working fine.

    Any idea why is this happening? How to pass comma?

    Many characters are indeed "special" in the context of a Uniform Resource Identifier (URI). These characters have a specific purpose when used in APEX URLs or URIs in general.

    As documented, in APEX URLs the itemValues parameter supports backslash escaping to enable values containing commas to be passed between pages. Change the Value in the link properties or URL to enclose the item reference in backslashes ("\"): \&P1_ITEM.\

    In APEX 5.0 an undocumented enhancement was introduced to extend this to values containing colons, which previously could not be passed at all.

    Note however that the safest and most secure approach is still to only pass numeric or alphanumeric key or UID values as URL parameters, and deal with expanding these into other required values in the target page.

    Adnan3114Niki DilipJeroen v Meenen

Answers

  • Adnan3114
    Adnan3114 Member Posts: 13 Red Ribbon
    Answer ✓

    It's because of how URLs are set up. The commas in the URL indicates which items will get which values. We actually faced a similar problem and found a solution. You can use a pre-rendering process on the target page and set the values of the previous page item to the target page.

    Pre-rendering process (PL/SQL):

    :P2_item_1 := :P1_item_1;

    :P2_item_2 := :P1_item_2;

    And give it a server-side condition so it executes only when getting redirected from page 1. For this you can use a single extra item on the target page and set it's value from the Branch of previous page.

    Server-side condition:

    :P2_STATUS = 'EXECUTE' (set the 'EXECUTE' value from branch)

  • fac586
    fac586 Senior Technical Architect EdinburghMember Posts: 21,579 Red Diamond
    Answer ✓

    why is it not taking comma? If i use any other special character, it is working fine.

    Any idea why is this happening? How to pass comma?

    Many characters are indeed "special" in the context of a Uniform Resource Identifier (URI). These characters have a specific purpose when used in APEX URLs or URIs in general.

    As documented, in APEX URLs the itemValues parameter supports backslash escaping to enable values containing commas to be passed between pages. Change the Value in the link properties or URL to enclose the item reference in backslashes ("\"): \&P1_ITEM.\

    In APEX 5.0 an undocumented enhancement was introduced to extend this to values containing colons, which previously could not be passed at all.

    Note however that the safest and most secure approach is still to only pass numeric or alphanumeric key or UID values as URL parameters, and deal with expanding these into other required values in the target page.

    Adnan3114Niki DilipJeroen v Meenen