?
Solved

missing hidden field

Posted on 2006-04-10
6
Medium Priority
?
226 Views
Last Modified: 2010-03-31
Hello expert ,
I have hidden field in a jsp
<input type="hidden" name="actionRequired"/>

I set the value in a javascript as below

if(validateSearchCriteria())
            {
                   alert("passed validation criteria");
                  if(document.forms["limsRecordAdvancedSearchForm"].elements["useAltSearch"].checked == true)                                 
                        document.forms["limsRecordAdvancedSearchForm"].elements["actionRequired"].value = "ALTERNATESEARCH";
                  /*else if(trimString(document.forms["limsRecordAdvancedSearchForm"].elements["recordNo"].value) != "")
                        document.forms["limsRecordAdvancedSearchForm"].elements["actionRequired"].value = "SINGLERECORD";*/
                  else                                          
                        document.forms["limsRecordAdvancedSearchForm"].elements["actionRequired"].value ="ADVANCEDSEARCH";
                        alert("setting actionRequired as" +actionRequired");
                        document.forms["limsRecordAdvancedSearchForm"].submit();
            }


The filed needs to set itself to ="ADVANCEDSEARCH" which it does , I check it with alert statment ,
but in the action class when i try to read the parameter

actionRequired = request.getParameter("actionRequired");
is get a empty string .
Why would something like this happen , where could i be lossing the data for the hidden field .

plz advice
0
Comment
Question by:eldoz12
6 Comments
 
LVL 14

Expert Comment

by:Tommy Braas
ID: 16420451
Post to the JSP TA, this TA is for Java questions.
0
 
LVL 5

Expert Comment

by:mrigank
ID: 16421001
Your form needs to be submitted in Order to propogate the hideen fields to the next request.

Just ensure that your form is getting submitted.

and the code <input type="hidden" name="actionRequired"/>
should be inside

<form>

</form>
0
 

Author Comment

by:eldoz12
ID: 16421493
yea it is between
<html:form>


</html:form>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 5

Expert Comment

by:mrigank
ID: 16422835
Ensure that the form is submitted to propogate the value of the hidden field.

form.submit is called.
0
 
LVL 8

Expert Comment

by:colr__
ID: 16424429
Use getParameterNames() on the rquest object in your action class to get a list of all the args that are being passed to the servlet.

This should help you debug, remember that java is case sensitive - could that be the problem?

Note also that if the value you are getting is an empty string as opposed to null, then you are probably reading the value correctly at your action class end, which means that the javascipt itself isnt working. If you were trying to read a value that doesnt exist, im pretty sure you would get a null value

colr__
0
 
LVL 5

Accepted Solution

by:
mrigank earned 750 total points
ID: 16424697
Use

<html:hidden property="actionRequired"/>
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn different types of Android Layout and some basics of an Android App.
The viewer will learn how to implement Singleton Design Pattern in Java.
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month17 days, 10 hours left to enroll

830 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