[thelist] Submitting a Form With a Link

Michael Stevens mike at tokenzone.com
Tue Jun 26 13:58:42 CDT 2001


Sal,

I'm not sure if it's possible to pull off with a text link.  What I do know
is that whatever you use to submit the form has to be some kind of form
element and enclosed inside the form tag.  As far as I know you can choose
from either the standard form submit button or an image.

-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Salvatore Palmisano
Sent: Tuesday, June 26, 2001 2:45 PM
To: thelist at lists.evolt.org
Subject: [thelist] Submitting a Form With a Link


I have a simple form I would like submitted with a text link instead of a
button.
I also have a small JS function that validates input for that form.

When I use this syntax to submit the form:
***
<A HREF="javascript: formsubmit();">continue</A></FORM>
***

formsubmit is the name of the validation function:
***
<script Language="JavaScript"><!--
function formsubmit(theForm)
{
  var theForm = document.esr

  if (theForm.strPerson.value == "")
  {
    alert("You Must Specify Who is Completing This Form.");
    theForm.strPerson.focus();
    return(false);
  }

     theForm.submit();
   return(true);
}
//--></script>
***

esr is the name of the form, and strPerson is the name of the required text
field.

If I use a button and the onClick event assigned to the function, everything
works fine.  With the link used for submission, the page clears and displays
'false' in the browser, and doesnt actually submit the form.
Am I missing a step?

--Sal


---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list