JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old July 27th, 2006, 08:28 AM
jgroom jgroom is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Nelson - UK
Posts: 5 jgroom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 59 sec
Reputation Power: 0
Need help with this JS form submitter

I cannot get the following code to work. I have tried various .submit() varieties - but they all give an error stating that xxx.submit is not a function - and the form is not submitted.

<head>
<script language=JavaScript>
function doB(x) {
var a = document.getElementById("submitForm");
a.value = x;
document.forms[0].submit();
// document.bForm.submit();
// var f = document.getElementById("bForm");
// f.submit();
}
</script>
</head>
<body>
<form name="bForm" id="bForm" action="default.asp" method="post">
<input id="submitForm" type="hidden" name="submit" value="">
<div onClick="doB('Option 1);">Option 1</div> &nbsp;
<div onClick="doB('Option 2');">Option 2</div>
</form>
</body>
</html>


Any help will be appreciated

Reply With Quote
  #2  
Old July 27th, 2006, 05:26 PM
TeamAwesomeWebs TeamAwesomeWebs is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 5 TeamAwesomeWebs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 42 m
Reputation Power: 0
The document.bForm.submit(); should work, be sure that you have javascript enabled on your browser. And be sure to try it out in different browsers to see if any work. I do see one problem though... on this line:
<div onClick="doB('Option 1);">Option 1</div>
you are missing a second quote on doB('Option 1');

Reply With Quote
  #3  
Old July 28th, 2006, 02:33 AM
jgroom jgroom is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Nelson - UK
Posts: 5 jgroom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 59 sec
Reputation Power: 0
Thanx for the reply.

I eventually found the answer the name=submit in the <input> tag was causing the problem - I changed it to submitX and it worked.

The missing quote was a typo.

Thanx very much
Regards
J

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Need help with this JS form submitter


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway