It's not a secret anymore!
The moose likes HTML, CSS and JavaScript and the fly likes one submit button two action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "one submit button two action" Watch "one submit button two action" New topic

one submit button two action

Simple Modi

Joined: Feb 05, 2006
Posts: 1
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 (lsStatus.equals("")) {
lsMessage = "";
lsAction = "add";

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

if (document.frmEquip.hfAction.value == "search"){
else if(document.frmEquip.hfAction.value == "add"){
var loForm = document.frmEquip;

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
"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.

Eric Pascarello
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
do an alert(document.frmEquip.hfAction.value) inside that form and see what the value is. (Is it what you expect?)

I agree. Here's the link:
subject: one submit button two action
It's not a secret anymore!