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="JavaS cript" type="text/javascript">
<!--
function radio_button_ch ecker()
{
if(radio_form.b ut1.value == "Continue")
{
if((radio_form. Desc.value == "")
|| (radio_form.Gen eral.value == 0)
|| (radio_form.Spe cific.value == 0))
{
alert("Please answer all questions.")
return (false);
}
return (true);
}
}
function decideLink()
{
if(radio.form.b ut1.value == "Continue")
{
return (page1.php);
}
if (radio.form.but 1.value == "Would Not Outsource Offshore")
{
return (pagenew.php);
}
}
-->
</script>
<form method="post" action="return decideLink()"
onsubmit="retur n radio_button_ch ecker()" name="radio_for m">
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="JavaS cript" type="text/javascript">
<!--
function radio_button_ch ecker()
{
if(radio_form.b ut1.value == "Continue")
{
if((radio_form. Desc.value == "")
|| (radio_form.Gen eral.value == 0)
|| (radio_form.Spe cific.value == 0))
{
alert("Please answer all questions.")
return (false);
}
return (true);
}
}
function decideLink()
{
if(radio.form.b ut1.value == "Continue")
{
return (page1.php);
}
if (radio.form.but 1.value == "Would Not Outsource Offshore")
{
return (pagenew.php);
}
}
-->
</script>
<form method="post" action="return decideLink()"
onsubmit="retur n radio_button_ch ecker()" name="radio_for m">
Comment