Hi,
So I know about Survey Builder application which can be downloaded - I did, but couldn't bother to 'reverse engineer' through the source code for my specific needs yet.
I was thinking it might be simple. For a start, I'm excluding the (item) type of questions, just to test with question titles and Text Fields for answers, no radio buttons or Yes/No type of items yet. Also there's a separate page where I create questions in application, of course.
On page where questionnaire is rendered, I built PL/SQL region with source along the lines of:
begin
for i in (
select *
from questions_t
)
loop
htp.p( i.question_title );
htp.p(
apex_item.text(
p_idx => i.id,
)
htp.p('<br /><br />');
end loop;
end;
This gives me the question above each TextField(for answer) for each. I'm using htp.p( i.question_title ); because apex_item.text doesn't have visible label (p_item_label is hidden).
On questionnaire page, I first need to pick from Interaction Type select list, the interaction type being category under which questions that need to render here belong to. After choosing from that select list, questions from this category will populate.
So I modifed as:
for i in (
select *
from questions_t
where interaction_type = : P10_INTERACTION_TYPE
)
loop
htp.p( i.question_title );
htp.p(
apex_item.text(
p_idx => i.id,
)
htp.p('<br /><br />');
end loop;
end;
(there's no space between : and P10 in actual code).
I've put Dynamic Action on P10_INTERACTION_TYPE, On Change, to refresh PL/SQL region.
-this does not work though. Not sure if I can use bind variables like this in PL/SQL regions, but I don't see why not. But I suppose its not like report where you have setting to add Page Items to Submit. So it doesn't apply, when I choose from select list on page, I won't get anything rendered in PL/SQL region, query probably doesn't work with WHERE=bind_vairable. This is the first issue. How can I populate questions depending on which Interaction Type was selected from SL?
-and if this way of building questions, or something similar, will work as a solution, how can I then submit a page to store answers typed into these text fields? (I will have table SURVEY, with foreign key to question and its answer, or something like that). How can I capture the answers into database from here?
(I will probably modify and add details to the whole thing, but this is a general idea)
Thanks.