Link to home
Start Free TrialLog in
Avatar of L00M
L00MFlag for United States of America

asked on

Retrieve dynamic HTML form fields using PL/SQL

I've created an HTML form which will submit to a PL/SQL package, however, I have buttons allowing the user to add an unlimited number of lines to the form. (Using Javascript). So, I'm unable to know the exact number of variables coming into PL/SQL. In ASP, I would do something like:

For each item in Request.Form
  Response.Write item & " = " & Request.Form(item) & "<br>"
Next

Can I do the same thing in PL/SQL? Is there a way to retrieve the entire collection of submitted variables?

TIA!
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

DHTML and dynamic form fields have always caused me problems.

I'm not sure exactly what you are asking here.  Are you wanting to know how to loop through items passed into PL/SQL or how to pass them into PL/SQL?

Straight ASP or ASP.Net?
Avatar of L00M

ASKER

The ASP code I provided is Classic ASP, just as an example.

And, yes, if I could loop through the form items submitted to the package, that would get me on the right track. Since it's dynamic, I can't just define the package like:

PROCEDURE p_submit_request(email varchar2 default null,
                          phone varchar2 default null, ...)

I won't know what those values are. I know they will be something like:

email_1, email_2, email_n
And I will be passing in a variable named 'totalcount' which will be equal to the number 'n' above.

Clear enough? If not, I'll try to clarify more.
It's been a LONG time since I've messed with classic ASP so I really doubt I'll be much help on that side.

Depending on your Oracle version and the data provider you are using (I hope not ODBC), I'm sure if you can access the form fields, we can get the data into PL/SQL.

Off the top of my head I'd probably go with passing the data in as XML.  A close second is passing them in as an 'Associative Array'.  Again, all this depends on your provider and Oracle version.
Avatar of L00M

ASKER

My question has nothing to do with ASP, I was providing that as an example of how I would do it in ASP. Clear your head  of that :)

As for the HTML form, as you can see, it's submitting it's data to ekeddpst.p_continue_form:

<FORM ACTION="ekeddpst.p_continue_form" METHOD="POST" onSubmit="return ValidateData()" NAME="valform" >

So, the data isn't being submitted as XML or as an associative array. It's simply a standard HTML form submit.

IE, if my form looked like:

<FORM ACTION="ekeddpst.p_continue_form" METHOD="POST" onSubmit="return ValidateData()" NAME="valform" >
<input name="input_1" value="1"><br>
<input name="input_2" value="2"><br>
...
<input name="input_n" value="n"><br>
<INPUT TYPE="submit" VALUE="Go">

So, not knowing the value of 'n', or how many fields there will be submitted (dynamic), how can I enumerate through every submitted field?

TIA
Avatar of L00M

ASKER

p_continue_form is a function within the package ekeddpst
>>Clear your head  of that :)

Cleared.  Sorry for the confusion.  I thought you had an ASP form that in turn called procedure from the server side script.

Never called a PL/SQL function straight from a web form.  I'll have to leave this to the other experts.
Avatar of L00M

ASKER

I ended up forcing the form to use no more than a defined static number of fields, and defaulting all incoming values to NULL.
Not the solution I'd like, but it'll just have to do until I learn more about PL/SQL.
Further comments are welcome.
Avatar of L00M

ASKER

PAQ with refund will be fine with me unless anyone else has objections.
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial