need some newbie help...

T

trfilmographer

Hi fellow web developers!

I have a little problem due to my lack of javascript / web developing
skills...

Basically I have a form embedded in a table. WHat I would like to do,
is have the form be submitted when I click on a href link. Currently
it appears that the page reloads - but nothing actually is submitted.

here is a demo code,,, is it something in the head?

<html>
<head>
<SCRIPT language="JavaScript">
function submitCode()
{
document.ApplyCode.submit();
}
</SCRIPT>
</head>
<body>

<table>
<tr>
<td>
<form action="thisPage.jsp" name="SubmitCode"
method="post">
Code:
<input type="text" name="Code" />
<!-- this is the line that doesnt work right -->
<a href="thisPage.jsp"
onClick="javascript: submitCode()">
Click Me
</a>
</form>
</td>
</tr>
</table>

</body>
</html>
 
T

trfilmographer

Hi fellow web developers!

I have a little problem due to my lack ofjavascript/ web developing
skills...

Basically I have a form embedded in a table.  WHat I would like to do,
is have the form be submitted when I click on a href link.  Currently
it appears that the page reloads - but nothing actually is submitted.

here is a demo code,,, is it something in the head?

<html>
<head>
<SCRIPT language="JavaScript">
        function submitCode()
        {
          document.SubmitCode.submit();
        }
</SCRIPT>
</head>
<body>

<table>
  <tr>
     <td>
           <form action="thisPage.jsp" name="SubmitCode"
method="post">
                        Code:
                        <input type="text" name="Code" />
                     <!-- this is the line that doesnt work right -->
                                                <a href="thisPage.jsp"
onClick="javascript: submitCode()">
                            Click Me
                          </a>
                </form>
    </td>
 </tr>
</table>

</body>
</html>

oops - Just so you know, there is still an issue, but the demo above
mis-named the form in the javascript... still need some guidance..
 
S

SAM

Le 9/25/08 8:16 AM, (e-mail address removed) a écrit :
oops - Just so you know, there is still an issue, but the demo above
mis-named the form in the javascript... still need some guidance..

You must stop the HTML link
(with return false;)

E.G. :

<a href="page.htm"
onclick="alert(this.href); return false;">href</a>


page's code :
-------------

<html>
<head>
<script type="text/javascript">
function submitCode()
{
document.SubmitCode.submit();
return false;
}
</script>
</head>
<body>
<table>
<tr>
<td>
<form action="thisPage.jsp" name="SubmitCode"
method="post">
Code:
<input type="text" name="Code" />
<!-- this is the line that doesnt work right -->
<a href="thisPage.jsp"
onclick="return submitCode()">
Click Me
</a>
</form>
</td>
</tr>
</table>
</body>
 
T

Thomas 'PointedEars' Lahn

I have a little problem due to my lack ofjavascript/ web developing
skills...
[...]
here is a demo code,,, is it something in the head?

[junk removed]

oops - Just so you know, there is still an issue, but the demo above
mis-named the form in the javascript... still need some guidance..

You should learn HTML before you make an attempt at Web programming.

<http://validator.w3.org/>


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,888
Messages
2,569,964
Members
46,293
Latest member
BonnieHamb

Latest Threads

Top