Solved

Posting Data from Form - But all fields are null when processing

Posted on 2004-07-30
4
240 Views
Last Modified: 2010-04-01
I am submitting the following form:
<form name="mainForm" method="post" action="index.jsp" enctype='multipart/form-data'>

with this submit button:
<input name="submit_form" type=submit value="Save" onClick="javascript:document.mainForm.submit();">

But when I get to the processing page, all of the field variables are null, for example:
<%
   String $subtitle = request.getParameter("subtitle"); //This is a field in the form
   out.println(" Subtitle_index=" + $subtitle);
   String $submit_form= request.getParameter("submit_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
0
Comment
Question by:mderbin
4 Comments
 
LVL 2

Expert Comment

by:k41d3n
ID: 11681567
Use get not post.

You are getting the values froma  post. not posting values from a  post.
0
 

Author Comment

by:mderbin
ID: 11682538
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.
0
 
LVL 27

Accepted Solution

by:
rrz earned 50 total points
ID: 11682592
>enctype='multipart/form-data'  
If you use that then you need necessary code at server to parse the multipart request.  You could use  
http://jakarta.apache.org/commons/fileupload/     
Are you uploading a file  ?
0
 
LVL 4

Expert Comment

by:Oliver_Dornauf
ID: 11704282
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.


0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Starting your own business is always a daunting process, and for most people it is brand new experience. Avoid the common pitfalls by following these tips to start on the road to success.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question