[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

missing hidden field

Posted on 2006-04-10
7
Medium Priority
?
262 Views
Last Modified: 2011-09-20
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
5 Comments
 
LVL 11

Expert Comment

by:fargo
ID: 16420998
would you mind posting your complete form ?
0
 
LVL 6

Expert Comment

by:nabsol
ID: 16421915
Hi
Yes, post your complete form.

1. May be you have not put your "hidden field" in your "form".
2. Try using hidden text box
    <input type="text" name="actionRequired" style="visibility:hidden"/>

I think it may help.

By Nab
0
 
LVL 35

Accepted Solution

by:
TimYates earned 500 total points
ID: 16424570
>> 2. Try using hidden text box

Why?

I'd give the hidden element an id:

    <input type="hidden" id="AR" name="actionRequired"/>

You are also missing { and } round the if and else blocks...

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

Tim
0
 
LVL 35

Expert Comment

by:TimYates
ID: 16424579
it's the fact that your javascript code is wrong that's giving you the problems I feel...
0
 
LVL 11

Expert Comment

by:raj3060
ID: 16426431
Just to debug:
Try to make hidden field as text field:

<input type="text" name="actionRequired"/>

then when you submit see what value you are getting in there.

If it is holding the value then your form class, or action class is malfunctioning.
0

Featured Post

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.

Question has a verified solution.

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

This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
If anyone asked you to network diagram of the internet, it was drawn in the form of a fluffy cloud which further became known as cloud computing. Popularly cloud computing is defined as workloads that run over the internet in a commercial provider’s…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month20 days, 14 hours left to enroll

810 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