Hi,
I am setting up a mailing list and it all very new to me. I was given some code for adding people to the list however no removing. what i have is 2 radio buttons (subsribe and unsubscribe) which u choose before submitting the email address. when the unsubscribe button is chosen i wanted the variable "action" to change from "add" to "remove" and vise-versa. Below is my code, if someone could have a look and spot any problems it would help because nothing seems to be happening as far as i know.
This is my script
<script Language="JavaScript"><!--
function subscribe(BMS)
{
if (BMS.RG[0].checked == true)
{
action.value="add";
}
if (BMS.RG[1].checked == true)
{
action.value="remove";
}
};
function validate(busmailsubscribe)
{
if (busmailsubscribe.email.value == ""
{
alert("Please enter an email address"
busmailsubscribe.email.focus();
return (false);
}
if (busmailsubscribe.email.value.length < 2)
{
alert("Not a valid email address"
busmailsubscribe.email.focus();
return (false);
}
subscribe(busmailsubscribe);
return (true);
};
//--></script>
and my form
<form action=" method="POST" name="busmailsubscribe" id="busmailsubscribe" onsubmit="return validate(this)">
<p>
<input type="hidden" name="action" value="add">
<input type="hidden" name="mailinglist" value="BusMail@dions.com.au">
<input type="hidden" name="redirect" value=" <input type="hidden" name="nowait" value="1">
<br>
<label>
<input name="RG" type="radio" value="subscribe" checked>
Subscribe</label>
<label>
<input type="radio" name="RG" value="unsubscribe">
Unsubscribe</label>
<br>
<br>
Email Address
<input name="email" type="text" size="20" maxlength="50">
<br>
<br>
<input type="submit" value="Submit" name="Submit">
</p>
</form>
I am setting up a mailing list and it all very new to me. I was given some code for adding people to the list however no removing. what i have is 2 radio buttons (subsribe and unsubscribe) which u choose before submitting the email address. when the unsubscribe button is chosen i wanted the variable "action" to change from "add" to "remove" and vise-versa. Below is my code, if someone could have a look and spot any problems it would help because nothing seems to be happening as far as i know.
This is my script
<script Language="JavaScript"><!--
function subscribe(BMS)
{
if (BMS.RG[0].checked == true)
{
action.value="add";
}
if (BMS.RG[1].checked == true)
{
action.value="remove";
}
};
function validate(busmailsubscribe)
{
if (busmailsubscribe.email.value == ""
{
alert("Please enter an email address"
busmailsubscribe.email.focus();
return (false);
}
if (busmailsubscribe.email.value.length < 2)
{
alert("Not a valid email address"
busmailsubscribe.email.focus();
return (false);
}
subscribe(busmailsubscribe);
return (true);
};
//--></script>
and my form
<form action=" method="POST" name="busmailsubscribe" id="busmailsubscribe" onsubmit="return validate(this)">
<p>
<input type="hidden" name="action" value="add">
<input type="hidden" name="mailinglist" value="BusMail@dions.com.au">
<input type="hidden" name="redirect" value=" <input type="hidden" name="nowait" value="1">
<br>
<label>
<input name="RG" type="radio" value="subscribe" checked>
Subscribe</label>
<label>
<input type="radio" name="RG" value="unsubscribe">
Unsubscribe</label>
<br>
<br>
Email Address
<input name="email" type="text" size="20" maxlength="50">
<br>
<br>
<input type="submit" value="Submit" name="Submit">
</p>
</form>