| houstoncity2004@yahoo.com 2005-02-10, 11:24 pm |
| 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">
|