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

Willing to pay for solution

P: n/a
I need a javascript function that will decide a form action determined by a
form string.
For instance I want the javascript to set the form action to go to one
script when a code number is entered into a field
and I want it to default to another script when this code number is not
present.
I need to solution to this ASAP I am in the middle of a major project and
dont have time to handle this detail.
Anyone that can provide me with a solution shall be compensated via paypal
or method you request.
Please contact me at:
Lance.s AT themediamechanics DOT com

Thank you!

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"lance" <pa***@sams-cycles.com> wrote in message
news:i%***************@fe2.texas.rr.com...
I need a javascript function that will decide a form action determined by a form string.
For instance I want the javascript to set the form action to go to one
script when a code number is entered into a field
and I want it to default to another script when this code number is not
present.
I need to solution to this ASAP I am in the middle of a major project and
dont have time to handle this detail.

Dear Mr Stehling

1. This newsgroup is for Java, not Javascript. The two are
not the same.

2. As Javascript executes on the client (i.e. the browser), the
code is insecure - anyone can browse it. Hence this method is
unsuitable for any kind of sensitive information.

3. Clients cannot be guaranteed to have Javascript running -
about 10% of people don't, for one reason or another.

If #2 and #3 don't dissuade you, then the following may help:
<html>
<head>
<title>My Motorcycles</title>
<script language='JavaScript'>
<!--
function doCheck() {
secretCode = 12345;
txt = document.forms.f.myText.value;

if (parseInt(txt,10) == secretCode) {
top.location = 'secretpage.html';
return false;
}
else {
return true;
}
}
// -->
</script>
</head>
<body>
<form name='f' action='defaultpage.jsp' onsubmit='return doCheck();'>
<input name='myText' type='text' />
<input type='submit' />
</form>
</body>
</html>

This works with IE, I won't guarantee it on any other
browser; also, I think you would be better off using
server-side code.
Jul 17 '05 #2

P: n/a
"lance" <pa***@sams-cycles.com> wrote in message news:<i%***************@fe2.texas.rr.com>...
I need a javascript function that will decide a form action determined by a
form string.
For instance I want the javascript to set the form action to go to one
script when a code number is entered into a field
and I want it to default to another script when this code number is not
present.
I need to solution to this ASAP I am in the middle of a major project and
dont have time to handle this detail.
Anyone that can provide me with a solution shall be compensated via paypal
or method you request.
Please contact me at:
Lance.s AT themediamechanics DOT com

Thank you!


What form processing are you using..ASP,Servlet etc
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.