|
Posted by houstoncity2004 on February 10, 2005, 5:32 pm
Please log in for more thread options
Hi, I need help to JavaScript. I am new to this, and am trying to the
page online ASAP. I
have two submit buttons on one form, and each button will have to do
different things.
I named both button "but1". The first button has the value "Continue",
the second button has
the value "new page". If someone click on the button with the value
"Continue", I need to
check if certain information has been filled in before proceeding, and
if yes, I need to go
to page1.php (which is the second page of the form) and I have to save
the result on a
database.
If someone click on the button with the value "New Page", I do not need
to check for
anything, but I have to go to pagenew.php (which is a different version
of the second page)
and also save the result onto a database.
I have the following codes, I have been trying for the whole day, it is
still not working.
Would some please help me? Thank you very, very much!
<script language="JavaScript" type="text/javascript">
<!--
function radio_button_checker()
{
if(radio_form.but1.value == "Continue")
{
if((radio_form.Desc.value == "")
|| (radio_form.General.value == 0)
|| (radio_form.Specific.value == 0))
{
alert("Please answer all questions.")
return (false);
}
return (true);
}
}
function decideLink()
{
if(radio.form.but1.value == "Continue")
{
return (page1.php);
}
if (radio.form.but1.value == "Would Not Outsource Offshore")
{
return (pagenew.php);
}
}
-->
</script>
<form method="post" action="return decideLink()"
onsubmit="return radio_button_checker()" name="radio_form">
|
|
Posted by Stephen Poley on February 11, 2005, 9:41 am
Please log in for more thread options
On 10 Feb 2005 16:32:24 -0800, houstoncity2004@yahoo.com wrote:
>Hi, I need help to JavaScript. I am new to this, and am trying to the
>page online ASAP. I
It would be more logical to go to comp.lang.javascript then, wouldn't
it?
>have two submit buttons on one form, and each button will have to do
>different things.
But while you're here, do ask yourself how people without Javascript are
going to use your site. See
http://www.xs4all.nl/~sbpoley/webmatters/whatnojs.html and
http://www.xs4all.nl/~sbpoley/webmatters/formval.html
>I named both button "but1". The first button has the value "Continue",
>the second button has the value "new page".
<snip>
And do ask yourself whether it will be clear to the user what you mean
by "Continue" and "Next Page". From the descriptions you give, I doubt
it.
--
Stephen Poley
http://www.xs4all.nl/~sbpoley/webmatters/
|
| Similar Threads | Posted | | Bug in IE with utf-8 and JavaScript | April 11, 2006, 5:26 am |
| How to do the same without javascript ? | May 21, 2007, 5:33 am |
| Javascript IP Mailer | August 19, 2004, 4:27 pm |
| Do viewers have JavaScript? | March 7, 2005, 9:49 am |
| 508 compliance and Javascript | March 15, 2006, 2:17 pm |
| Forms and javascript | March 30, 2006, 7:36 pm |
| Javascript and Frames | August 14, 2006, 11:42 am |
| Javascript encryptor | March 27, 2007, 3:30 pm |
| Javascript problem? | July 10, 2007, 11:59 am |
| ISO HTML and Javascript | November 7, 2007, 2:19 am |
|