View Full Version : problem with 'return false;'

08-29-2010, 04:48 PM
I have the following form:

<form action="/cgi-bin/script.cgi" method="POST" onsubmit="check_create()">
<legend>Create project</legend>
Type <input id="type" type="text" name="type" size="20" /><br/>
Name <input id="project" type="text" name="project" size="20" /><br/>
Language to use <input id="language" type="text" name="language" size="20"/><br/>
<input type="hidden" name="profile" value="[% profile %]"/>
<input type="submit" value="Create" />

and check_create function is:

function check_create() {

var type = document.getElementById('type').value;
var pname = document.getElementById('project').value;
var language = document.getElementById('language').value;
if ((type == '') || (pname == '') || (language == '')) {
alert('You must complete form');
return false;
else alert('Ok');


The problem is that return false doesn't work, but form lanch /cgi-bin/script.cgi.
Where is the problem? Why return false doesn' work?


08-29-2010, 06:28 PM
onsubmit="return check_create()"

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum