Posts

Showing posts with the label jquery

Building dynamic forms

How do I build a dynamic form? Well first, you need to have your questions stored somewhere, so we set up the following (basic) model: CREATE TABLE DYNAMIC_QS( ID NUMBER PRIMARY KEY, QUESTION_KEY VARCHAR2(20) NOT NULL, QUESTION_TYPE VARCHAR2(20) NOT NULL, QUESTION_SEQ NUMBER NOT NULL ); / CREATE TABLE DYNAMIC_ANS( ID NUMBER PRIMARY KEY, QUESTION_KEY VARCHAR2(20) NOT NULL, QUESTION_ANS VARCHAR2(4000) NOT NULL ); / create sequence dynamic_qs_seq; / create or replace trigger BI_DYNAMIC_ANS before insert on DYNAMIC_ANS for each row begin :NEW.ID := dynamic_qs_seq.nextval; end BI_DYNAMIC_ANS; / insert into DYNAMIC_QS values (1, 'NAME', 'TEXT', 10); insert into DYNAMIC_QS values (2, 'AGE', 'TEXT', 20); insert into DYNAMIC_QS values (3, 'ADDRESS', 'TEXTAREA', 30); / create or replace view v_dynamic_qs as select dynamic_qs.id , dynamic_qs.question_key , dynamic_qs.question_type , dynamic_ans.quest...

Triggering dynamic actions from a dialog button

A typical usage scenario is you create a region, give it a static ID, and set the default display to be hidden - the latter is handled if you select your region template as modal region. A typical JavaScript dynamic action to display the dialog, would be: $('#dialog-region').dialog({ width: 500, title: 'My Dialog', buttons: [ { text: 'Submit', click: function() { $(this).dialog("close"); } }, { text: 'Cancel', click: function() { $(this).dialog("close"); } } ] }) So the question is, how do we get some other dynamic action to fire when the button is clicked? Option 1 On the button, give it an id property, such as: { text: 'Submit', id: 'btn-submitDialog' click: function() { $(this).dialog("close"); } } And then, on your dynami...

Google Visualization API (Org Chart)

Wanted to have a go at making a family tree, and came across this API. It is worth noting this particular chart doesn't allow you to specify more than one node for the parent, so not exactly perfect for a family tree. See:  http://code.google.com/p/google-visualization-api-issues/issues/detail?id=162 . I believe it worthwhile to read the getting started guide for google visualizations: http://code.google.com/apis/visualization/documentation/using_overview.html and the actual guide for using the organizational chart: http://code.google.com/apis/visualization/documentation/gallery/orgchart.html . Why use this over the charts provided in APEX? For one thing, there is no organizational chart available, to my knowledge. For another, it is not flash ;-) That can only be a good thing! Alright, down to business. Firstly create a table to store the data: CREATE TABLE "PERSON" ( "PERSON_ID" NUMBER NOT NULL ENABLE, "NAME" VARCHAR2(200 BYT...

APEX AJAX Basics

Introduction I'll start of by saying this post isn't about achieving any particular task via AJAX - there are plenty of examples out there already - but how to perform AJAX with Application Express. There seems to be no official documentation on the matter, so wanted to do a general overview on how to achieve AJAX techniques. Of course, it is also worth mentioning, writing your own AJAX functions is not so necessary anymore, with the addition of Dynamic Actions in APEX 4. Never the less, it is still worth knowing. The most common technique for AJAX in Application Express is to have PL/SQL code in an on demand process, and then calling that process via Javascript at run time. Application Express provides a helper function for calling an on demand process, and that is htmldb_Get (and additionally, apex.ajax.ondemand which is effectively a wrapper object for htmldb_Get object). With the release of APEX 4, came the jQuery library included - so another option for using AJAX is...