Welcome visitor
* Login
* Register
It is currently March 19th, 2019, 7:52 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » HTML



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  submit form only with submit button
PostPosted: May 13th, 2009, 6:38 am 
User avatar

Posts: 61
When you have a form and press enter the form is submitted, how can i turn that off so the users need to click the submit button?


Top
 Profile  
 
  Re: submit form only with submit button
PostPosted: May 13th, 2009, 6:47 am 

Posts: 117
What i would do is make the submit button different from all others:

1. Declare a variable, lets say a=0
2. On the submit button add the code
onkeyup="a=1;" onmouseover="a=1;" onmouseout="a=0"

3. When the form is submitted validate it using javascript
<form onsubmit="javascript:return validate(this);">

4.Only submit if a is 1
function validate(myForm){
if (a<=0){
     alert ('Press the submit button');
     return false;}
return true;}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » HTML


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron