eldoz12
asked on
missing hidden field
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["limsRec ordAdvance dSearchFor m"].elemen ts["useAlt Search"].c hecked == true)
document.forms["limsRecord AdvancedSe archForm"] .elements[ "actionReq uired"].va lue = "ALTERNATESEARCH";
/*else if(trimString(document.for ms["limsRe cordAdvanc edSearchFo rm"].eleme nts["recor dNo"].valu e) != "")
document.forms["limsRecord AdvancedSe archForm"] .elements[ "actionReq uired"].va lue = "SINGLERECORD";*/
else
document.forms["limsRecord AdvancedSe archForm"] .elements[ "actionReq uired"].va lue ="ADVANCEDSEARCH";
alert("setting actionRequired as" +actionRequired");
document.forms["limsRecord AdvancedSe archForm"] .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("acti onRequired ");
is get a empty string .
Why would something like this happen , where could i be lossing the data for the hidden field .
plz advice
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["limsRec
document.forms["limsRecord
/*else if(trimString(document.for
document.forms["limsRecord
else
document.forms["limsRecord
alert("setting actionRequired as" +actionRequired");
document.forms["limsRecord
}
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("acti
is get a empty string .
Why would something like this happen , where could i be lossing the data for the hidden field .
plz advice
would you mind posting your complete form ?
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
it's the fact that your javascript code is wrong that's giving you the problems I feel...
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.
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.