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

Submit working only in FF

P: n/a
Hi!

Firstly I have to tell that my english isn't perfect, so forgive me for
that.

Second: I have little problem with this code:

<a href="javascript:;" title="Edit"
onclick="document.formularz.edited_param_id.value= '0';document.formularz.submit()">Edit&nbsp;&laquo; </a>

It's working fine only in Firefox 0.9, but why not in IE or Opera ?
Where is the bug ?

--
Regards, Caesar.
================================
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Lee
Cezar said:

Hi!

Firstly I have to tell that my english isn't perfect, so forgive me for
that.

Second: I have little problem with this code:

<a href="javascript:;" title="Edit"
onclick="document.formularz.edited_param_id.value ='0';document.formularz.submit()">Edit&nbsp;&laquo ;</a>

You're telling the browser to do two different things at the same time:
1. submit the form
2. follow the link in the HREF attribute, and so stay on the same page.

If you don't want to follow the link in the HREF attribute, you
should always return false from the onclick handler.

Jul 23 '05 #2

P: n/a
Lee napisał(a):
You're telling the browser to do two different things at the same time:
1. submit the form
2. follow the link in the HREF attribute, and so stay on the same page.

If you don't want to follow the link in the HREF attribute, you
should always return false from the onclick handler.


You right! Now working fine.

Thank You.

--
Regards, Cezar.
================================
Internet Explorer? Powinni tego zabronić.... :-P
" ..posiada moduł telepatyczny.." - przyszłe opcje przegl±darek
Jul 23 '05 #3

P: n/a
In article <ci**********@atlantis.news.tpi.pl>,
Cezar <ce*****@imail.net.pl> wrote:

<a href="javascript:;" title="Edit"
onclick="document.formularz.edited_param_id.value= '0';document.formularz.submi
t()">Edit&nbsp;&laquo;</a>

You are using a link to submit a form. While I have not seen the web
page, it is best to be consistent as possible. Links are for
navigation. Buttons are used to submit forums.

Here is an example of validating a forum then submitting the form.

Robert

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Check a form field</title>

<script type="text/javascript">

function validate(x)
{
var submitOK = true;
var messageText =
"What a suprise! Please correct the error in your ways." +
" Please remove the asterisk ( * ) in the name field.";

if (x.elements["theName"].value.indexOf("*") >= 0)
{
alert(messageText);
submitOK = false;
}

return submitOK;
}

</script>
</head>
<body>
<p>
This html file shows how to cancel a submit.
To cancel the submit, place an asterisk ( * ) in the name field.
</p>
<form name="myForm"
action="http://www.natAValidWebAddress.com"
method="POST"
onsubmit="return validate(document.forms['myForm']);">
<p>Name:<br>
<input type="text" name="theName" size="20"></p><br><br>
<input type="submit" value="Please submit">
</form>
</body>
</html>
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.