hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : javascript
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

javascript

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 11-15-2010, 05:09 AM
mohammadi mohammadi is offline
Junior Guru Wannabe
 
Join Date: Aug 2010
Location: Iran
Posts: 36
Question

javascript


Hello,
I have a form with a link with out any button, and I`m going to submit this form by clicking this link and it is like this:
<a onclick="java-script: document.myform.submit();"></a>
It works sometimes but most of the time It doesn`t work and there is an error on page.
How can I solve this problem?
thanks.

__________________
mohammadi


Reply With Quote


Sponsored Links
  #2  
Old 11-15-2010, 12:05 PM
Doh004 Doh004 is offline
Web Hosting Guru
 
Join Date: Jan 2004
Location: NJ, USA
Posts: 288
Quote:
Originally Posted by mohammadi View Post
Hello,
I have a form with a link with out any button, and I`m going to submit this form by clicking this link and it is like this:
<a onclick="java-script: document.myform.submit();"></a>
It works sometimes but most of the time It doesn`t work and there is an error on page.
How can I solve this problem?
thanks.
I think you should remove the - in your 'java-script'. I'm pretty sure it's just 'javascript'

__________________


Reply With Quote
  #3  
Old 11-15-2010, 12:28 PM
ThatScriptGuy ThatScriptGuy is offline
Web Hosting Master
 
Join Date: Feb 2003
Location: AR
Posts: 2,370
You also don't need the javascript: bit either.

<a href="javascript:" onclick="document.myform.submit();"></a>

However, you really should avoid using javascript for something as important as submitting a form (Or at least provide a solution for those without JS enabled)

__________________
Kevin Cackler
Tech Daddies - A Conway, Arkansas based development company.
501-205-1512

Reply With Quote
Sponsored Links
  #4  
Old 11-16-2010, 01:33 AM
Crandion Crandion is offline
WHT Addict
 
Join Date: Nov 2010
Posts: 120
For a very basic form it would be best to use pure HTML like it was suggested.

http://www.w3schools.com/html/html_forms.asp

Reply With Quote
  #5  
Old 11-16-2010, 01:34 AM
ubservers ubservers is offline
Premium Member
 
Join Date: Apr 2010
Location: Canada
Posts: 1,763
Quote:
Originally Posted by ThatScriptGuy View Post
You also don't need the javascript: bit either.

<a href="javascript:" onclick="document.myform.submit();"></a>

However, you really should avoid using javascript for something as important as submitting a form (Or at least provide a solution for those without JS enabled)
I agree here.
What you can do is set your form action to go to your javascript to client check before sending, then php check just to make sure and then process your form.

__________________
Maxence H. - UBservers.com
Specialists in high-performance hosting since 2008!
Outstanding 24x7 support - Canada, USA, France

SSD VPS Dedicated Servers SSD Web Hosting

Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript function has no properties in javascript console mrblack Programming Discussion 2 05-25-2005 02:15 PM
Javascript help! isara Web Design and Content 5 11-15-2004 12:43 PM
JAVAScript help netmanpro Programming Discussion 2 10-27-2004 11:15 AM
Need Some Help with Javascript Gamenati Programming Discussion 2 01-02-2003 03:06 PM

Related posts from TheWhir.com
Title Type Date Posted
Facebook's Recently Acquired Mobile App Platform Parse Launches Web Hosting for Developers Web Hosting News 2013-05-08 10:49:17
Web Host DiscountASP.NET Launches Beta Support for Node.js on Windows Platform Web Hosting News 2012-07-24 16:04:04
Software Developer Softaculous Launches Softaculous Auto Installer Version 3.8 Web Hosting News 2011-11-25 15:34:49
Hurricane Electric Offers Online Courses for Developers and Designers Web Hosting News 2011-11-14 21:51:44
Microsoft Launches First Beta of Microsoft WebMatrix 2.0 Web Hosting News 2011-09-26 15:43:24


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?