The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Form not sending (javascript validator)

Sorry, I am a novice at javascript, and this script was mostly put together by my programmer friend, who isn't currently available to help me with this so i'm stumped!

This form I have has a validator and that part is all working, so that's good, but while I was testing I didn't have it actually submitting and now that I've added the action and the email address to send it to I realise it doesn't even send..

I think it's actually lacking anything that tells it to send. im using a regular button instead of a submit button. i just need to know where to put the 'submit' function and how!

<script language="javascript" type="text/javascript">
//setup initial modal properties
var modal = document.getElementById('modalWdw');
function showModal()
{
modal.style.display='block';
}
function hideModal()
{
modal.style.display='none';
return true;
}
function doValidate()
{
var group1Checked;
for (var i=0; i<document.getElementsByName('Group1').length; i++)
{
if (document.getElementsByName('Group1')[i].checked)
{
group1Checked = document.getElementsByName('Group1')[i].value;
}
}
if(!group1Checked)
{ //if group1Checked does not equal null
alert("You did not make a selection.")
}
else
{
alert('Thankyou, your selection was: ' + group1Checked);
return true;
}
}
showModal();
function checkOnLoad()
//essentially, this function just scans the current page url and looks
// for the querystring (after the '?'), then checks to see if "modal=true"
// was included as a querystring key-value pair
{
var arr = window.location.href.split(/\?/g);
if (arr.length >= 2)
{
var vals = arr[1].split(/=/g);
if (vals.length >= 2)
{
for (var i = 0; i<vals.length; i++)
{
if (vals[i] == 'modal')
{
if (vals[i+1] == 'true')
{
return true;
}
}
}
}
}
else
{
//no modal
hideModal();
}
return false;
}
(checkOnLoad() ? showModal() : hideModal());
</script>
all that modal=true stuff is to show or hide the div in which the form is in, it only shows if the page is directed from a certain address, and it only disappears if the form is validated.
Can anyone see where I need to insert something to make the form actually SEND to the email adress?
All it seems to do onclick is check to see if it is validated..