473,800 Members | 2,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

window.document .formaname.subm it() not working for some case.

4 New Member
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 2736
acoder
16,027 Recognized Expert Moderator MVP
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
vinsim24
4 New Member
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 Recognized Expert Moderator MVP
Try adding some form elements. It's an empty form.
Nov 19 '07 #4
vinsim24
4 New Member
I have some table and div in the form i am workin in,,,,
So wat after that
Nov 19 '07 #5
acoder
16,027 Recognized Expert Moderator MVP
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
vinsim24
4 New Member
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 Recognized Expert Moderator MVP
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
3793
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 HTML form to. the actual form-parsing page resides on a server that's uneditable to me since it sits on an inaccessible server. my problem is more irritating than anything; everything double-submits.. when you submit the form, I've forced a...
4
12912
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 server to process. So when the new windows is loaded into the browser, I want to close this Wait window. I have found a global JavaScript variable I may use.
1
1994
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 another window and submit the typed text to different action/script to give a preview. So far I have done this (removing the excess formatting HTML for clarity): ---------- <SCRIPT language="JavaScript" type="text/javascript"> function...
14
11099
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 window.open function? I would prefer not to create a separate HTML page. So far all I have is the basic var cwin = window.open('images/KJV-THANKS.gif', 'Thanks', 'width=243,height=420,'); cwin.focus();
2
6960
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. After entering these two items the user can either hit the enter key or press the submit button. The popup window will close and then those two text boxes in the original webpage will be filled in automatically. I would like to have the two...
5
8042
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: // Parent window: <script language="JavaScript"> function popup(url, name) { window.open(url, name, "width=800,height=600,scrollbars=yes");
2
1374
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 seconds. I need to add a popup window displaying this message. Can anyone suggest me how to do this? I just need to open 1 window , sense some event in parent window and then close the popup window..Kindly please help I truly apppreciate your...
9
2602
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" runat="server"/> <asp:Label ID="CompanyPicture" runat="server"/> I have 2 links that open the windows to preview these images. The previewed images are done on separate html pages that do nothing but display the
11
5326
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. How do I submit that form1 from the javascript from my current window? Thanks.
0
10273
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10250
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10032
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5603
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.