mderbin
asked on
Posting Data from Form - But all fields are null when processing
I am submitting the following form:
<form name="mainForm" method="post" action="index.jsp" enctype='multipart/form-da ta'>
with this submit button:
<input name="submit_form" type=submit value="Save" onClick="javascript:docume nt.mainFor m.submit() ;">
But when I get to the processing page, all of the field variables are null, for example:
<%
String $subtitle = request.getParameter("subt itle"); //This is a field in the form
out.println(" Subtitle_index=" + $subtitle);
String $submit_form= request.getParameter("subm it_form"); //This is the actual submit button
out.println(" SubmitButton=" + $submit_form);
%>
Returns: "Subtitle_index=null SubmitButton=null"
I have temporarily changed the method to get, and all of the values in the fields show up in the URL, but when I make the method post, I get back a bunch of nulls.
Am I missing something simple here?
Thanks,
Michael
<form name="mainForm" method="post" action="index.jsp" enctype='multipart/form-da
with this submit button:
<input name="submit_form" type=submit value="Save" onClick="javascript:docume
But when I get to the processing page, all of the field variables are null, for example:
<%
String $subtitle = request.getParameter("subt
out.println(" Subtitle_index=" + $subtitle);
String $submit_form= request.getParameter("subm
out.println(" SubmitButton=" + $submit_form);
%>
Returns: "Subtitle_index=null SubmitButton=null"
I have temporarily changed the method to get, and all of the values in the fields show up in the URL, but when I make the method post, I get back a bunch of nulls.
Am I missing something simple here?
Thanks,
Michael
ASKER
But I wasn't wanting all of the data to be displayed in the URL, and it has the potential to be VERY long, so the characters in the URL will certainly run over at times.
So I was under the impression that I would need to use a "post" method in my form.
So I was under the impression that I would need to use a "post" method in my form.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The input type submit or button have no _value_ you c! If you use java script to submit your form (i.e you need multiple submitt buttons or do some client side validation) you should use the input type button.
You are getting the values froma post. not posting values from a post.