• 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

window.close(); and Form submit problem in JS

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am facing a problem for Form submitting using java script.

JS code is :

function onClickAddTransRecv()

{

// actionType is the hidden variable in the JSP page.

document.TransRecvInfoForm.actionType.value = "addTransRecvSubmit";

document.TransRecvInfoForm.submit();

//window.alert("TransRecvInfoForm form submitted");
OR
// alert("TransRecvInfoForm form submitted");

window.close();
OR
self.close();
}

In the action class I try to fetch the value of actionType using

String sAction = (String) request.getParameter("actionType");



Using this code when I submit the form in the Action class I get the value of "actionType" is null instead of "addTransRecvSubmit".

But if I use "window.alert" OR normal "alert" between Form submission and window closing I get the value of "actionType" is "addTransRecvSubmit" in the Action class.

Please help
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check in the form class whether you have a getter/setter method for the variable.Try putting a request.getParameter inside the action class.If you are getting the value in request.getParameter and not otherwise.then getter/setter is the problem.Please check the same and revert
 
shankha bhattacharya
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes I already used

String sAction = (String) request.getParameter("actionType"); in my action class to get the value but still getting null.

I can only avoid the problem if I put alert or window.alert(" .. ") message
between form submit and window.close().

- so still I have the problem --
 
reply
    Bookmark Topic Watch Topic
  • New Topic