Kalfja
Kalfja

Reputation: 63

Oracle Apex- Enter a value and convert it to a link

I have a Master Detial with 2 interactive grids. I would like to be able to genrate a link based on user input....is that at all possible? To give a simple example: Lets say I have website like https://www.google.com/ I would like a user to enter anything...for example "Prague" Once this is entered, I would like APEX to generate a URL from it to result in: https://www.google.com/Prague

Now I know that Google search does not work like that, but I need that sort of mechanism for our internal company app. Is this possible? Ideally , once the grid is saved the link in the Interactive grid only said "Prague" but if I click it, it would direct me to https://www.google.com/Prague

Upvotes: 1

Views: 1049

Answers (2)

Koen Lostrie
Koen Lostrie

Reputation: 18640

This can be achieved using the "JavaScript Initialization Code" attribute of the column. Example on the EMP sample table (*). Functionality is that when a user enters a value in the ENAME column, it is converted to a google search url.

  1. Create an editable IG on table EMP
  2. Set the type of column ENAME to "Text Field"
  3. Set "Javascript Initialization Code" for column "ENAME" to
function(config) {     
    config.defaultGridColumnOptions = {         
        cellTemplate: '<a href="https://www.google.com/search?q=&ENAME." target="_blank">&ENAME.</a>'     
    };     
    return config; 
} 

Notice that the column now is a link. A user will have to open in new window to get the actual link value, since clicking the column will active the edit mode.

(*) Sample dataset can be installed using SQL Workshop > UTILITIES > Sample Data Sets > EMP/DEPT

Upvotes: 2

cengiz sevimli
cengiz sevimli

Reputation: 2105

yes, you can let user enter the value and by creating a dynamic action(choose the when attribute as whatever suits you) you can take that value and on another column, use that column as &Columnvalue. for example and concatanate it by using to base url using ||

Upvotes: 0

Related Questions