473,386 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

window.document.formaname.submit() not working for some case.

Hi all,
the code where i am finding a problem is as follows:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script>
  4. function fun1(){
  5. window.document.formName.action="/someServlet";
  6. window.document.formName.submit();
  7. }
  8. </script>
  9.  
  10. </head>
  11.  
  12.  
  13.  
  14. <body>
  15. <form  name="formName" action = "/ab.jsp" method ="post">
  16. <a href="#" onClick="fun1();" >Some Link</a>
  17.  
  18. </form></body>
  19. </html>
  20.  

The problem here is when i click on the hyperLink it goes to the onClick method and from there the action is set to be redirected to a servlet(even when action was set to a jsp it didnt work), but it doesnt call the submit() method after that,...


Why is this so???

Plz do clarify the doubt....
Nov 19 '07 #1
7 2692
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

I've never worked with servlets so this may be a useless question, but do servlets not require an extension, e.g. .jsp?

Try:
Expand|Select|Wrap|Line Numbers
  1. document.forms["formName"].action="/someServlet";
  2. document.forms["formName"].submit();
Your form doesn't have any elements, so what's going to be posted?
Nov 19 '07 #2
Hi...
Well the action is going to some controller which in my case is a servlet.
I put alert before the submit() method. I am even gettin that alert but after that the form is not getting submitted....
Why is it so???
Nov 19 '07 #3
acoder
16,027 Expert Mod 8TB
Try adding some form elements. It's an empty form.
Nov 19 '07 #4
I have some table and div in the form i am workin in,,,,
So wat after that
Nov 19 '07 #5
acoder
16,027 Expert Mod 8TB
I have some table and div in the form i am workin in,,,,
So wat after that
Post the code. Do you get any errors?
Nov 19 '07 #6
Well the flow is as follows...
There is one jsp(java code in HTML file) by name Options.jsp and it has a top file called TopFrame.jsp . there is a hyperLink in Options.jspt file say like this:
Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:void(0);" onClick="logoff()">Logout</a>

this logff() method has code like this
Expand|Select|Wrap|Line Numbers
  1. top.close();

the Topframe.jsp has in its body onLoad method calls one more logOff method in that TopFrame.jsp file.
In this logoff method i am calling
Expand|Select|Wrap|Line Numbers
  1. document.formname.action="/someservlet"
  2. alert("Came before submit");
  3. document.fromname.submit();
  4.  
i reach till the alert message is thrown but after that submit is not called.... This is wat my concern was./...
Nov 19 '07 #7
acoder
16,027 Expert Mod 8TB
Check your code that it doesn't contain form elements with the name "action".

Do you not see any errors?
Nov 19 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Display Name | last post by:
the customer I'm developing a site for uses a canned form-parsing page that allows her to have an email subscription opt-in page add emails to a list she can manage using a link that you point your...
4
by: GTi | last post by:
Hello... I have a page located in a frame. This page contains a form. When the user submit this form I want to popup a "Please Wait" window popup window The post may take some time for the...
1
by: Terence Parker | last post by:
I have a form which enables users to type in some text in a <TEXTAREA>, allowing them to use HTML. I have defined two submit buttons - one to submit as usual, but one which I would like to popup...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
2
by: jackson2005 | last post by:
OK, I need to do three different things. On the ONLOAD event I would like a popup box to open. In this popup box I need two text boxes. One for the UserName and one for the BillingTo name. ...
5
by: midnight_use_only | last post by:
hi all, quick question, how do you submit a form to a parent window from a child popup window? i have the following and all online documentation *suggests* that it should work but it does NOT: ...
2
by: Devika | last post by:
Hi, I am working on online recharge module. Everything is in place but when you click on submit it does not notify user that the request is getting processed and he needs to wait for couple of...
9
by: tshad | last post by:
This was posted before but the message got messed up (all NLs were stripped out for some reason). I have 2 labels that hold the name of different images on my .aspx page. <asp:Label ID="Logo"...
11
by: V S Rawat | last post by:
using Javascript, I am opening a web-based url in a popup window. MyWin1=Window.Open(url, "mywindow") There is a form (form1) in the url in that popup window, I need to submit that form. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.