• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 351
  • Last Modified:

borrow me your eye.

Hi, when i press the "Set Priority" in this page, it's not able to pass the user_action value to the servlet. i wonder why. I can repeat (can pass) by press others button.. on man.. this is killing me...

<html>

<head>
<script language = "javascript">

function IncidentSubmit() {
      document.incident_main.user_action.value="incident_details";
}

function caseFile() {
      document.incident_main.action = "caseFile";
      document.incident_main.user_action.value="caseFile";
}

function p_case() {
      document.incident_main.user_action.value="priority";
}


function checkRadios() {
 var el = document.forms[0].elements;
 for(var i = 0 ; i < el.length ; ++i) {
  if(el[i].type == "checkbox") {
   var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
   var itemchecked = false;
   for(var j = 0 ; j < radiogroup.length ; ++j) {
    if(radiogroup[j].checked) {
       itemchecked = true;
       break;
      }
   }
   if(!itemchecked) {
    alert("Please choose an Incident.");
    if(el[i].focus)
     el[i].focus();
      return false;
   }
  }
 }
 return true;
}

function checkRadiosCase() {
 var el = document.forms[0].elements;
 for(var i = 0 ; i < el.length ; ++i) {
 
  if(el[i].type == "checkbox") {
   var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
   var itemchecked = false;
   for(var j = 0 ; j < radiogroup.length ; ++j) {
    if(radiogroup[j].checked) {
       itemchecked = true;
       break;
      } // end if
   } // end for
   
   if(!itemchecked) {
    alert("Please choose an Incident.");
    if(el[i].focus)
     el[i].focus();
      return false;
   } // end if
  } // end if
 
 }//end for
 return true;
}



</script>
</head>
<body>
<%
List incidentList = (List)session.getAttribute("incidentList");
List userList = (List)session.getAttribute("all_user");

String pid = (String)session.getAttribute("profile_id");
%>
<form name="incident_main" method="post" action="incident" onsubmit="return checkRadios(this);">

<table border="0"  cellpadding="2" width="100%">
 
<tr>
<td>No</tD>
<td>&nbsp; </td>
<td>Incident ID</td>
</tr>

<%
int counter=0;
for (int i=0; i<incidentList.size(); i++) {
      IncidentObject io = (IncidentObject) incidentList.get(i);
counter++;
%>
<tr>
<td><%= counter %></td>
<td><input type="checkbox" name="iid" value="<%= io.getIid() %>"> </td>
<td><%= io.getIid() %></td>
</tr>
<%
}
%>

</table>



<input type="hidden" name="user_action" >
<br>
<select name="target_user">
<option value=""> Please Select User here ... </option>
<%
for (int x=0; x<userList.size(); x++) {
      userObject uo = (userObject)userList.get(x);
%>
      <option value="<%= uo.getUid() %>"><%= uo.getUser_name() %> ( <%= uo.getUid()%> )</option>
<%
}
%>
</select>


<input type="hidden" name="profileid" value="<%= pid %>" >
<input type="submit" value="Assign to Case File" onClick="caseFile();" >


<br><BR><BR>
<input type="submit" value="Incident Details" onClick="IncidentSubmit();" >
<input type=button value="Back" onClick="history.go(-1)">
<input type="hidden" name="user_action">
<br><BR><BR>

<select name="priority">
      <option value=""> Set Priority Here </option>
      <option value="LOW">LOW</option>
      <option value="MEDIUM">MEDIUM</option>
      <option value="HIGH">HIGH</option>
</select>
<input type="hidden" name="test" >
<input type="submit" value="Set Priority" onClick="p_case();" >

</form>
</html>
0
xman19
Asked:
xman19
  • 3
  • 3
  • 2
1 Solution
 
objectsCommented:
what does your servlet code look like:
0
 
objectsCommented:
or is the servlet not getting called?
0
 
KuldeepchaturvediCommented:
you have two user_action fields in your form...! thats why its behaving erraticly..

>>>
<input type="hidden" name="user_action" >
<br>

and
>>><input type=button value="Back" onClick="history.go(-1)">
<input type="hidden" name="user_action">
<br><BR><BR>


Delete one of them & try again..
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
xman19Author Commented:
object, the sevlet is called but then it's cant get the "user_action"

Kuldeep, the user_action appear twice is not the cause of this issues. i have tired to remove one and it's still cant get the user_action.

I think is the html problems, as i have been doing this for many time. but now i can't locate tjhe problemativ code.
0
 
xman19Author Commented:
or in short, where should i put this code?
<input type='hidden' name="user_action">
0
 
KuldeepchaturvediCommented:
normally I keep all my hidden variables at the bottom of the page.. just above the closing form tage..

in the servlet when you try to get user_action what value do you get?

in HTML if you have same variable twice.. it creates a array for that variable... ( I have faced that problem more than twice...)..
thats why I asked you to remove one...

also in your javascript function  p_case()  put an alert, just to make sure that its being called...
0
 
xman19Author Commented:
you are right. it's sovled. doouble user_action.
0
 
KuldeepchaturvediCommented:
glad to be of help...:-)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now