[thelist] Submitting a Form With a Link

Chris Evans chris at fuseware.com
Tue Jun 26 14:09:41 CDT 2001


Try modifying your link like so:

<A HREF="javascript:return formsubmit();">continue</A>

Hope that helps,

Chris Evans
chris at fuseware.com
http://www.fuseware.com



-----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