Hi, I ve been the victim of Javascript these days.I was trying to submit my form generated thro servlet .My form contains three buttons SUBMIT BACK CANCEL.so i m not able to use input type =SUBMIT that does not allow three buttons in a single row.So i used javascript onClick=somefn that submits the form finally by document.myform.submit().It many times gave error of object expected so I used \"parent.location=../../nextservlet.It worked fine but could not receive values thro req.getParameter().It gave NULL values. so Does parent.location not submit the form actually? What is the best soln for this?PLEASE START THE LIST ABOUT THE POSSIBLE ERROR CASES OF JAVASRIPT(object expected)AND POSSIBLE SOLNS FOR IT.please.
VAIBHAV <BR>SCJP
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4089
posted
0
Stay away from javascript as much as possible. you can have a "submit" and a "cancel" in straight html but "back" will need a button with a onclick(i think). You can use multiple submits if you uses seperate forms for them(worth thinking about). Anyway since I cant solve your problem outright I thought I would give you my advice. Use script as a last resort. There is too much browser incompatibility and possible script errors for me to like it.
SCJP
Ajan Balakrishnan
Ranch Hand
Joined: Jan 04, 2001
Posts: 71
posted
0
I don't think parent.location submits the form. What you need to do here is have all the 3 buttons as type SUBMIT with same name and different values and inside your servlet get the value see which button is pressed. Take a look at the follwoing example.
Alternate way to have a cancel button, as Randell mentioned earlier, have them as type cancel so as to avoid further checking at the server side. Let me know if this helps Ajan
[This message has been edited by Ajan Balakrishnan (edited February 17, 2001).]