By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,850 Members | 1,962 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,850 IT Pros & Developers. It's quick & easy.

need some newbie help...

P: n/a
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>
Sep 25 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Sep 25, 1:51*am, trfilmograp...@gmail.com wrote:
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..
Sep 25 '08 #2

P: n/a
SAM
Le 9/25/08 8:16 AM, tr************@gmail.com a écrit :
On Sep 25, 1:51 am, trfilmograp...@gmail.com wrote:
>Hi fellow web developers!

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>
Sep 25 '08 #3

P: n/a
tr************@gmail.com wrote:
On Sep 25, 1:51 am, trfilmograp...@gmail.com wrote:
>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
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Sep 26 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.