Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Ora-Apex:How to capture screen field values from a manual HTML form

Amir SiddiquiOct 26 2015 — edited Oct 26 2015

Hi All,

I have a question that has been a headache for me for last 2 days. I am developing an application in Oracle APEX 5. The problem is that on one page, I have to generate an HTML form manually, based on some data in a table (Not through form wizard offered in APEX), but when I submit the form, on the next page I am unable to reference the form fields filled on the previous page. Here is my page region code having the form:

/* source-code for a PL/SQL dynamic region */

declare

vc1 varchar2(107);

vc2 varchar2(35);

vc3 varchar2(35);

vc4 varchar2(35);

vc5 varchar2(35);

vc6 varchar2(35);

item_typ varchar2(50);

BEGIN

htp.p ('<form name="page1_form" method="get" action="user_resp.php">');
htp.p ('<div style="font-size:x-small;">');
htp.p ('Email:  <input type="text" id="v_email">  ');
htp.p ('<br/> <br/>');

select todayq,opt1,opt2,opt3,opt4,opt5,item_type
   into vc1,vc2,vc3,vc4,vc5,vc6,item_typ
   from todaysq
  where dowk = to_number(to_char(sysdate,'D'));

htp.p ('<p id="vc1">' || vc1 || ' </p> <br/>');
IF upper(item_typ) IN ('RADIO','CHECKBOX') THEN
   if vc2 is not null and vc2 != ' ' then
      htp.p (' <input type="' || item_typ || '" name="ans1" value="1" id="vc2"> ' || vc2 || ' <br/> ');
   end if;
   if vc3 is not null and vc3 != ' ' then
      htp.p (' <input type="' || item_typ || '" name="ans1" value="2" id="vc3"> ' || vc3 || ' <br/> ');
   end if;  
   if vc4 is not null and vc4 != ' ' then  
      htp.p (' <input type="' || item_typ || '" name="ans1" value="4" id="vc4"> ' || vc4 || '<br/> ' );
   end if;
   if vc5 is not null and vc5 != ' ' then
      htp.p (' <input type="' || item_typ || '" name="ans1" value="3" id="vc5"> ' || vc5 || '<br/> ');
   end if;
   htp.p ('<br/> <br/>');
ELSIF upper(item_typ) IN ('TEXT','PASSWORD','TEXTAREA') THEN
   htp.p (' 1.<input type="' || item_typ || '" name="ans1" id="vc2" value="' || vc2 || '"> <br/> ');
   htp.p (' 2.<input type="' || item_typ || '" name="ans2" id="vc3" value="' || vc3 || '"> <br/> ');
   htp.p (' 3.<input type="' || item_typ || '" name="ans3" id="vc4" value="' || vc4 || '"> <br/> ' );
   htp.p ('<br/> <br/>');
END IF;

htp.p ('<button type="submit"> Submit </button>');
htp.p ('</div>');
htp.p ('</form>');

EXCEPTION

WHEN OTHERS THEN 

   htp.p('What is causing you to search for a new job? <br/> <br/>'); 

   htp.p(' <input type="radio" name="ans1" value="1"> Current Salary <br/> '); 

   htp.p(' <input type="radio" name="ans1" value="2"> Location<br/> '); 

   htp.p(' <input type="radio" name="ans1" value="4"> Unhappy with Management<br/> ' ); 

   htp.p(' <input type="radio" name="ans1" value="3"> Less Vacations<br/> <br/>'); 

   htp.p('<button type="submit"> Submit </button>');  htp.p('</div>');  htp.p ('</form>');

END;

(I am sorry if the code is not properly format). But here is the problem.... when I click the submit button, I have a PL/SQL process that is intended to insert the values entered on previous form into a table:

/* PL/SQL process code in the 'Page processing' section */

begin

  Insert into user_opinions

   (uemail,tquestion,uanswer)

   values (:v_email, :vc1, :v2) ;

end;

But in the result, I always see that a record is inserted with all null values.... meaning that the form fields values are not available to the PL/SQL process in the 'Page processing' section.

Can someone please help me telling how the form fields values can be referenced in session state, so that we can use them in PL/SQL.

Thanks in Advance.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 23 2015
Added on Oct 26 2015
2 comments
830 views