• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

one submit button two action

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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();

}
}
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic