Individual and multiple 'batch' Form Posting using HTML?

F

Fernie

Dear friends,

I have 20 different forms on a single html page. Each form has its own text
input field and submit button to update text and a submit button to delete.

Each of the 20 forms consists of the following html:

<FORM method='POST' action='Products.cgi'>

// Display product details.

// Display a text Input Field.

// Display an submit 'update' button to post both
// input and hidden field data.

// Display a submit 'delete' button to post the
// record ID and delete the record.

</FORM>

When I click on the submit button belonging to any of the 20 forms on the
html page, the appropriate data is correctly posted to the server and either
a successful update or deletion is performed.



Now for the problem. All along, I had wrongly assumed that I could embed
all 20 forms within a single 'larger' form and perform a bulk update/delete
process. That large form would submit all of the smaller forms input and
hidden field data in one whack. After trying to figure it out, I sadly
discovered that this was not possible using html.

Ideally, I would like to handle this without relying on client side
scripting. Is there a way to accomplish this using plain html? If there is
not a way to do this, I am thinking that it may be best to assign each
item's delete button to a GET. Also, I'd have to get rid of the individual
update buttons and have a single form that updates the whole batch
regardless if one or two items were updated.

Any comments or suggestions would be much appreciated.

Regards,

Fernie
 
M

Mitja

Fernie said:
Dear friends,

I have 20 different forms on a single html page. Each
form has its own text input field and submit button to
update text and a submit button to delete.

Now for the problem. All along, I had wrongly assumed
that I could embed all 20 forms within a single 'larger'
form and perform a bulk update/delete process. That
large form would submit all of the smaller forms input
and hidden field data in one whack. After trying to
figure it out, I sadly discovered that this was not
possible using html.

Make it all _one_ big form with 21 buttons (submit1,
submit2, ..., submitAll). When the form is submitted, have
your server-side script check for the name of the button via
which the form was submitted. If the name is e.g. submit7,
only do the requested operations on product number 7; if the
name is submitAll, process all POST data.
The problem (probably) here are users submitting the page
with the ENTER key. There are guidelenes as to which
key-value pair browsers should submit, but they are not
implemented well enough to be relied upon. Google for html
form submit enter or something.

HTH,
Mitja
 
F

Fernie

Make it all _one_ big form with 21 buttons (submit1,
submit2, ..., submitAll).

Mitja,

Thank you very much for the excellent suggestion!

Best regards,

Fernie
 
F

Fernie

Mitja,

I began looking at the form variables that are posted (via post) to the web
server and noticed something interesting with the buttons I use. I have a
button named btnSave. When clicked, I end up with an expected variable
named 'btnSave' and the value is 'Save Changes'.

In another instance, I post by clicking on a gif image (instead of a regular
button). Looking at the server variables, I get the mouse coordinates of
the button click. For example, I have an image button named 'btnUpdate'.
The form variables that are posted to the server are:

btnUpdate.x and the value is 40
btnUpdate.y and the value is 5

This means that I cannot specifically look for a variable named btnUpdate,
unless I trim off the '.x' or the '.y'. Then I get the variables that you
suggested that I look at (btnUpdate1, btnUpdate2, ...).


Regards,

Fernie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top