Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about submitting in a jsp page using (IE and mozilla) 1

Status
Not open for further replies.

FreshmenProgrammer

Programmer
Jan 16, 2006
42
CA
This is a simple jsp program below in mozilla when i press submit or close the value("pressed") gets posted on the screen beside either submit value or close value depending on what button was pressed. But in IE i get null values for both. Does anyone have any idea why. Thank you so much in advance. Take care.

Code:
<%
String submit = request.getParameter( "submit" );
String change = request.getParameter( "close" );
%>

submit value: <%= submit%><br />
Close value: <%= change%><br />

<form action = "submittesting.jsp" method = "post">
 			
<input type="image" src="images/submit.bmp" value="pressed"    name="submit">
<input type="image" src="images/close.bmp" value="pressed"   name="close">
			
</form>
 
Hi,

<input type="image" src="images/submit.bmp" value="pressed" name="submit"> your querystring will hold submit_x=111&submit_y=222 where 111 and 222 are the mousepointer x and y locations at the moment you clicked. You should therefor not check on "submit" variable, but on a different variable.

In I.E. you can not find the submit variable value, one can only see the x and y positions of the mousepointer with type="image"


I would rather use JavaScript as a workaround.

Cheers
Venu
 
Venu,

Thank you for the post it was really helpful. Looking at that I think i would rather do the javascript thing. Can javascript set a post variable and then submit the form. Like set close to pressed and submit the form right after.

what i'm really trying to do is a question confirmation page if i press the change button go back to the previous page and change the questions and if u press submit go to the next page. So i need to set a variable then post the form.
 
Hi,

Yes before the page submit you need to set the variable with the value using JavaScript.

Ex:
Code:
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>My Page</title>
    <script language="javascript">
     function setValue(val){
      document.myForm.buttonValue.value = val;
     }
    </script>
  </head>
  <body>
  <%
    String buttonValue = request.getParameter( "buttonValue" );
    if(buttonValue.equals("next")){
     // go to the next question
    }else if(buttonValue.equals("previous")){
      // go back to previous page
    }
  %>

      Button Pressed Value is: <%= buttonValue%><br />
      

<form action ="" method = "post" name="myForm">
 <input type="hidden" name="buttonValue" value="">            
<input type="image" src="images/submit.bmp" value="pressed" name="submit" onClick="setValue('next')">
<input type="image" src="images/close.bmp" value="pressed" name="close" onClick="setValue('previous')">
            
</form>
  </body>
</html>

Cheers
Venu
 
Venu,

Thank you so much!!! That worked great! Exactly what I was looking for. I'm fresh out of school and new to web programming. Thank you so much for your help much appreciated.

Cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top