Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

one submit button two action

 
Simple Modi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I want to submit a form to itself first to search and then after checking business logic (checking the input values by query), I want to submit it to another form on the other frame in the same frameset.
I am using java and javascript to achieve this. Here is my code on the JSP page. It is skiping the search and directily going to ADD form. I will appreciate if you can give me a hint.

jsp page codes:

<input type="hidden" name="hfAction" value="<%=lsAction%>">

if(!lsContainerNo.equals(null)){
if (lsStatus.equals("")) {
lsMessage = "";
lsAction = "add";

%>
<script language="JavaScript" >
ufAdd();
</script>
<% }
And here is the javascript code
-------------------------------
function ufAdd(){
if (ufValidate()){

if (document.frmEquip.hfAction.value == "search"){
document.frmEquip.submit();
}
else if(document.frmEquip.hfAction.value == "add"){
var loForm = document.frmEquip;
document.frmEquip.action="cm_eq_detail.jsp";
document.frmEquip.target="results";
loForm.submit();

}
}
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Simple Modi",

Welcome to the Ranch. There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

Thanks,
Eric Pascarello
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do an alert(document.frmEquip.hfAction.value) inside that form and see what the value is. (Is it what you expect?)

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic