Wednesday 15 April 2015

APEX 5.0 released today

Oracle announced release of Application Express 5.0 

What a way to wake up?!

This morning  I participated in ODTUG APEX Development Team AMA catchup meeting and boy did guys from APEX team prepare us a surprise!!!!!!!!

Main thing is APEX 5.0 is available for download as of today!!!!!!

Date to write down is 14 of April 2015. :)

This should be a brief review of things we went through and things people were interested in.

First thing that David and the rest of the team did was to announce that APEX 5.0 version is finally here and it is available for download on Oracle website. 

All in all it was worth waking up at 04:00 AM NZ time to take part to see what was latest in APEX world. Finally we got an opportunity to see all members of APEX Development team that been making efforts to get 5.0 version in front of us.

Most of the questions were mostly around APEX 5.0 and its current ability and future aspects and plans. Questions like ability to integrate with EBS, more support to produce PDF reports that will match page layout, Universal theme customizations and about upgrades of current 4.2.x themes to it etc.

Definitely I am hoping APEX team will continue to have these catchup's where APEX public will be able to take part. For a first time, I think meeting went very well.... of course you will always have some minor internet connection problems but except for that meeting had a head and its tail. 

This way I would like to thank all APEX team members for doing a great job and for "delivering" version 5!!!!!

For us others it is time to go and visit your best friends DBAs to create new environments were we can finally start to create our first 5.0 production application.

Thanks,
SLino

Monday 6 April 2015

Checkbox converted into text area

Checkbox to support free text entry

Apex version 4.2.x and 5 - Theme 25

An interesting request came through the other day from a client requesting a very simple thing. Once checkbox selected to open additional field for free text entry. 

This is better described with these images

Item before
Item After
As simple as it seemed to me took me a bit of time to think through how am I going to solve this.

Initial idea to simple convert last item into a free text area didn't work for me as then all entered values would be shown under my checkbox item which was not what I was after. 

This is a simple to-do list to follow. 
  1. Alter your table so that in that extra column you can store values of newly entered text input field
  2. Create one page items to store your original value - mine is called OTHER_DETAILS
  3. Create DA to handle the logic of changes done on screen once original checkbox was clicked (ORACLE_RESPONSIBILITY) and execute two JavaScript actions
Script 1
Script 2
These are both of the JavaScript codes here for you to use. 

Please keep in mind that you will have to change names of variables used together with all Page referenced fields. 

 $("#P75_OTHER_DETAILS").hide();
var originValue = $x('P75_OTHER_DETAILS').value;
   
// HTML to be added that creates temp TEXT area
var addedHtml = '<tr><td></td><td><div id=P75_OTHER_DETAILS_CONTAINER_TEMP> <div><fieldset id=P75_OTHER_DETAILS_fieldset class=textarea tabindex=-1><textarea wrap=virtual style=resize: both; name=p_t51 rows=5 cols=80 maxlength=200 id=P75_OTHER_DETAILS_TEMP class=textarea></textarea></fieldset></div></div></td></tr>';
  
//check if last Other option is checked
if($( "#P75_ORACLE_RESPONSIBILITIES input:last:checked" ).prop('checked')){
//CHECK IT DOESNT exist
if( !$('#P75_OTHER_DETAILS_CONTAINER_TEMP').length ) {
    //THEN BUILD TEXT AREA as new column of that table
   $( "#P75_ORACLE_RESPONSIBILITIES input:last").closest("tr").after(addedHtml);          
  $('#P75_OTHER_DETAILS_TEMP').focus();      
  }
} else { //hide temp text area
  //remove newly added element
  $('#P75_OTHER_DETAILS_CONTAINER_TEMP').remove();
  //CLEAR original value
  $s('P75_OTHER_DETAILS', '');
} //end if checked

//set temp to original
if(originValue == $x('P75_OTHER_DETAILS').value){
  $s('P75_OTHER_DETAILS_TEMP', originValue); //SET TEMP TEXT ARE TO initial value
  }

Second JS script
$( "#P75_OTHER_DETAILS_TEMP" ).change(function() {
//only if original value different than new one
if( $x( "#P75_OTHER_DETAILS").value != $x( "#P75_OTHER_DETAILS_TEMP").value){
     $s('P75_OTHER_DETAILS', $x( "#P75_OTHER_DETAILS_TEMP" ).value);
 }
});
The final result should let you enter a value once last item from your checkbox is selected keeping the values in you text box if there were previously saved.

Of course you can further develop your code to include references to objects with APEX supported syntax of this.triggeringElement but for purpose of making the code as clear as possible I posted the code with the full names.


Cheers,
SLino