|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Difficult form submit problem tell me is it impossible
I have a difficult problem with no idea how to solve it at the moment I
The problem is as follows at the moment I have the following java/HTML code while(rs.next()) { %> <form name="setlimits" method=POST action="controlservlet"> <tr> <input type="text" name="new_limit" size=10> <tr> <tr> <td> <input type="text" name="new_limit" size=10> <td> <tr> <tr> <input type="submit" value="Amend Limit"> </form> <tr> <% } When I press submit the controlservlet is called and two parameters passed to it new_limit and a corresponding index. index = request.getParameter(“index”); new_limit = request.getParmeter(“new_limit”); This allows me to update a table row with the new_limit in the database where index = index. What I have now been asked to do is to also supply a submit all button, when this button is pressed I should pass to the controlservlet all the new limits with all the corresponding indexs. Is this possible, As I see it this will be a client side operation as all the data has to be entered first, what I need is to run a javascript function which will extract all the indexes and limits and pass them into a javascript object, which I can then translate into a java object. Is this possible Thanks Tony |
|
#2
|
|||
|
|||
|
There has to be an easy solution, but cant find it on the web
Maybe my first explanation was too complex
<form name="limits" method=POST action="global"> <input type="text" name="new_limit" size=10> <input type="hidden" name="borg_num" value="<%= rs.getString("borg_num") %>"> <input type="submit" value="Amend Limit"> when run it will look like this if I have 4 limits to set limits [] (amend limit) [] (amend limit) [] (amend limit) [] (amend limit) I enter data into one of the boxes say 10 and press the button (ammend limit) then the data entered 10 plus the hidden identifier for that limit borg_num will be fired of to the control servlet. I have been asked to add another button (ammend all) limits [] (amend limit) [] (amend limit) [] (amend limit) [] (amend limit) (amend all) what this button will do is if I enter data in all four boxes on pressing submit I will need to get all 4 limits with all four matching borg_num identifiers and pass to the controlservlet. I have written the amend all button <input type="button" value="Amend All" onclick="submitAll()" /> <form name="allForm" method=POST action="global"> <input type="hidden" name="cmd" value="temp_limits"> </form> and have started the javascript function <script> function submitAll() { document.getElementById("allForm").submit(); } </script> I have no idea how to pick up new_limit and borg_num from the form and store them in a document. Thanks for any help. Tony |
|
#3
|
||||
|
||||
|
In your servelet, I'd think you'd just create a request object and access the request variables using that object. My java's a little rusty, so I can't give specifics. Basically, though, it looks like you're getting hung up on client-side stuff when all you really need to do is post to the servelet and then add code to the servelet that extracts values submitted through the form.
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Difficult form submit problem tell me is it impossible |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|