?
Solved

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

Posted on 2004-07-30
4
Medium Priority
?
248 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 28

Accepted Solution

by:
rrz earned 200 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Strategic internal linking is often considered an SEO power technique, especially for content marketing. Do you need to hire an SEO agency to optimize you internal linking? No, this article will help you understand the basics of internal linking and…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

850 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