Thursday, 26 April 2007

ApEx + Javascript = Ajax


Understanding the syntax of javascript is a hard piece of work. I have to admit, that I just started to understand some small portions of it. However, many of the functions you need, have already been written by someone and they are available for a free download. A simple Google-Search will bring you there. But the real power of javascript in ApEx comes as a combination of it and PL/SQL, called Ajax. In my demo application, thera are several examples on how to utilize javascript and a page process on demand. It saves time and looks much better than refreshing a complete page. Here, you can find examples for:

- selecting a value using select list,
- populating multiple items using select list,
- cascading select and pop-up lists,
- creating a shopping cart,
- calculating date differences and
- using the famous Auto-Complete functionality.


Many of the examples are comming from Carl Backstrom. I just modified them a little bit. All the pages include a detailed description on how to set it up + the corresponding code.

Have fun!

6 comments:

Anonymous said...

Hi Denes,
FYI..
Apex+javascript is certainly not Ajax. Ajax stands for asynchronous javascript and xml.

To achieve ajax like functionality you need to use Apex's ajax api which is not widely published.

cheers
-Venkat

Anonymous said...

Hi Denes,

As Venkat i would say ApeX +Javascript is not Ajax at all...Venkat gave the definition of Ajax.

What i can say about integrating Ajax features into Apex...it does not please me at all.
Having experience with Apex ancestor ten years ago (WebDB), then left this for Java/J2EE , then came to Ruby on Rails... and retrying ApeX today on a project , whereas i learned these last years some well known Javascript frameworks for Ajax like Prototype, scriptaculous, jQuery, Dojo, GWT..yet another API for Ajax to learn with APEX..and comparing with the best Ajax integration done in a framework : RoR...with ApEX it's simply a back in time.
Gain you have with Apex on pre-built screens (forms, reports, trees), are lost whenever you want to integrate modern Web 2 features.

Anonymous said...

Hi Denes,

I'd like to request that you start using apex.oracle.com instead of htmldb.oracle.com on your blog and in your forum posts. I think there's a lot of potential for confusion with newer users who only know of the tool as "APEX".

Just my 2 cents...
Tyler

Unknown said...

Hi Denes,
i have an aplication, a grid, where i put an icon to delete the row, when press this button, i want delete the record. To do that, i made a javascript popup with JQuery, where i set the id of the record on a variable with the predefine function $S(pDOM,pVAL), then use the function doSubmit('DELETE');, but this event clear the set up of the value. What could be it's the problem?

darkcraft said...

>> Apex+javascript is certainly not Ajax. Ajax stands for asynchronous javascript and xml.

REALLY. You don't say? :o

Anyone who'd understand the examples provided is likely to be familiar with what the abbreviation means (in fact the mention of XML hasn't precluded people using all sorts of data primarily JSON - and Javascript's only mentioned because it's dominant at the moment.) The only important word in 'AJAX' is ASYNCHRONOUS.

Apex's original model was a cycle of calls to the apex engine - the option of adding this functionality relatively easily to a powerful (free) app builder is of genuine interest.

>> What i can say about integrating Ajax features into Apex...it does not please me at all.

None of the javascript libraries that you've namedropped bear any relevance to the issue. You could use any of these embedded in an APEX page. These are responsible for the client-side processing, not the server side. Again, the point here is that newer versions of APEX offer an easy way to make Oracle data/functions/procs available for asynchronous clientside processing.

Denes Kubicek said...

The title of this posting was intended to be a funny wording - rather a joke or a pun. Also, this posting is two and a half year old. You seem to be a smart guy if I listen to your comments but you definitely have no sense of humor - even your hiding behind a pseudonym is humorless. Are you a kind of a Dart Vader or what? Personally I also don't like some tools but this is probably because I don't understand them. And that is why I stick with something I like and (hopefully) understand.

Denes